a bug in /bin/ls

Polytropon freebsd at edvax.de
Thu Aug 13 23:29:39 UTC 2015


On Fri, 14 Aug 2015 01:09:59 +0200, Dr. Andreas Haakh wrote:
> On:
> FreeBSD Crabberio.Haakh.de 10.2-PRERELEASE FreeBSD 10.2-PRERELEASE #0
> r286580: Mon Aug 10 19:49:05 CEST 2015    
> toor at Crabberio.Haakh.de:/usr/obj/usr/src/sys/CRABBERIO  amd64
> 
> using the "-U"-flag in /bin/ls  together with "-l"
> leads to the following output
> [...]
> -rwxr--r--  1 krabbe  ibh    798720  1 Jan  1970 IMAG1562.jpg
> -rw-r--r--  1 krabbe  ibh    579493  1 Jan  1970 IMAG1714.jpg
> [...]
> 
> and the sorting is not affected by the flag (still by name).

What file system (FS type) do those files reside on? It seems
that the file creation date hasn't been recorded properly (or
the file system in use doesn't have that feature), or the date
has been reset to "zero" (00:00:00 UTC on 1 January 1970).
It's also possible that FS inode data got corrupted.

However, sorting by creation date using -U doesn't seem to work
on my system, too:

% ll
-rw-r--r--   1 poly  staff      0 2015-08-14 01:21:29 a
-rw-r--r--   1 poly  staff      0 2015-08-14 01:21:25 b

This is sorted by name, as expected, but:

% ll -U
-rw-r--r--   1 poly  staff      0 2015-08-14 01:21:29 a
-rw-r--r--   1 poly  staff      0 2015-08-14 01:21:25 b

Those lines should be in reverse order... and none of the
time-related flags (-c, -u, -U) seems to change the fact
that the files are sorted alphabetically.



NB: ll = 'ls -laFG -D "%Y-%m-%d %H:%M:%S"' :-)



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list