bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #45780] inode column is badly aligned when running 'find <dir> -ls'


From: Bernhard Voelker
Subject: [bug #45780] inode column is badly aligned when running 'find <dir> -ls'
Date: Mon, 17 Aug 2015 21:54:58 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0

Follow-up Comment #1, bug #45780 (project findutils):

Thanks for the report.
However, your example output seems to be mangled: as find(1) is
using "%6s " for the inode numbers, you cannot get a smaller
inode "column" than 6 characters.


$ find/find /home /var /dev /media -maxdepth 0 -ls 
     2    4 drwxr-xr-x   9 root     root         4096 Nov  9  2014 /home
262146    4 drwxr-xr-x  12 root     root         4096 Nov  9  2014 /var
  1025    0 drwxr-xr-x  18 root     root         4580 Aug 16 22:27 /dev
1048577    4 drwxr-xr-x   6 root     root         4096 Nov  9  2014 /media

Are you sure you are using the original GNU find? (Downstream
distributions may have added patches to modify this behaviour btw.).

Anyway, the basic observation is correct: the alignment may vary
among the output lines.

The reason is that find(1) outputs the -ls line per entry immediately,
while "ls -dils" internally calculates the biggest inode number width
of all arguments prior to actually outputting the entries.

The point is that find(1) is made for an unlimited number of entries
to find, thus making it impossible to internally calculate and store
all entries like ls(1) does.

BTW: ls(1) does the same pre-calculation on a per-directory
basis when running recursively, i.e., you may get different
alignment due to the inode numbers at least for each
(sub-)directory.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?45780>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]