/bin/ls sorting bug?

Scott Mitchell scott+freebsd at fishballoon.org
Sat Jun 19 19:35:48 GMT 2004


On Sat, Jun 19, 2004 at 09:01:37PM +0200, Dimitry Andric wrote:
> On 2004-06-19 at 19:50:07 Scott Mitchell wrote:
> 
> > (562) tuatara:/tmp/foo $ ls -lt
> > total 0
> > -rw-rw-r--  1 scott  wheel  0 19 Jun 17:48 c
> > -rw-rw-r--  7 scott  wheel  0 19 Jun 17:13 b
> > -rw-rw-r--  7 scott  wheel  0 19 Jun 17:13 d
> > -rw-rw-r--  7 scott  wheel  0 19 Jun 17:13 e
> > -rw-rw-r--  7 scott  wheel  0 19 Jun 17:13 f
> > -rw-rw-r--  7 scott  wheel  0 19 Jun 17:13 g
> > -rw-rw-r--  7 scott  wheel  0 19 Jun 17:13 h
> > -rw-rw-r--  1 scott  wheel  0 19 Jun 17:13 i
> > -rw-rw-r--  1 scott  wheel  0 19 Jun 17:13 j
> > -rw-rw-r--  7 scott  wheel  0 19 Jun 17:13 a
> > -rw-rw-r--  1 scott  wheel  0 19 Jun 17:13 k
> 
> Can you please show the output of "ls -ltT" ?

Sure (added -i to make it easier to see what's going on here):

(505) tuatara:/tmp/foo $ ls -iltT
total 0
35 -rw-rw-r--  1 scott  wheel  0 19 Jun 17:48:40 2004 c
11 -rw-rw-r--  7 scott  wheel  0 19 Jun 17:13:36 2004 b
11 -rw-rw-r--  7 scott  wheel  0 19 Jun 17:13:36 2004 d
11 -rw-rw-r--  7 scott  wheel  0 19 Jun 17:13:36 2004 e
11 -rw-rw-r--  7 scott  wheel  0 19 Jun 17:13:36 2004 f
11 -rw-rw-r--  7 scott  wheel  0 19 Jun 17:13:36 2004 g
11 -rw-rw-r--  7 scott  wheel  0 19 Jun 17:13:36 2004 h
41 -rw-rw-r--  1 scott  wheel  0 19 Jun 17:13:36 2004 i
51 -rw-rw-r--  1 scott  wheel  0 19 Jun 17:13:36 2004 j
11 -rw-rw-r--  7 scott  wheel  0 19 Jun 17:13:36 2004 a
52 -rw-rw-r--  1 scott  wheel  0 19 Jun 17:13:36 2004 k

Most of those files (a,b,d,e,f,g,h) are hard-linked to each other - so they
definitely share the same timestamp.  i,j,k were created with 'touch -r a i
j k', so they should also have the same time.  c is different to make sure
I didn't break the sort order when files *did* have different times.

	Scott

-- 
===========================================================================
Scott Mitchell           | PGP Key ID | "Eagles may soar, but weasels
Cambridge, England       | 0x54B171B9 |  don't get sucked into jet engines"
scott at fishballoon.org | 0xAA775B8B |      -- Anon


More information about the freebsd-hackers mailing list