Subject: ls bug

From: Toby Kelsey <[email-masked]>
Date: Tue, 16 Apr 2024 16:07:59 +0100

There appears to be a bug with 'ls' when using the '-f' and '-l' options, or at least an inconsistency with the man 
page. The man page says '-f' list entries in directory order and does not mention any incompatibilities with other 
options, however I find using it with the '-l' option gives different ouputs depending on the order of options. See the 
following script log for an example:

toby@toby-pc:/tmp$ mkdir test
toby@toby-pc:/tmp$ cd test
toby@toby-pc:/tmp/test$ touch c b a foo bar
toby@toby-pc:/tmp/test$ ls -lf
.  ..  c  b  a  foo  bar
toby@toby-pc:/tmp/test$ ls -fl
total 0
drwxr-xr-x  2 toby toby 140 Apr 16 15:50 .
drwxrwxrwt 18 root root 560 Apr 16 15:50 ..
-rw-r--r--  1 toby toby   0 Apr 16 15:50 c
-rw-r--r--  1 toby toby   0 Apr 16 15:50 b
-rw-r--r--  1 toby toby   0 Apr 16 15:50 a
-rw-r--r--  1 toby toby   0 Apr 16 15:50 foo
-rw-r--r--  1 toby toby   0 Apr 16 15:50 bar
toby@toby-pc:/tmp/test$ ls -l -f
.  ..  c  b  a  foo  bar
toby@toby-pc:/tmp/test$ ls -f -l
total 0
drwxr-xr-x  2 toby toby 140 Apr 16 15:50 .
drwxrwxrwt 18 root root 600 Apr 16 15:57 ..
-rw-r--r--  1 toby toby   0 Apr 16 15:50 c
-rw-r--r--  1 toby toby   0 Apr 16 15:50 b
-rw-r--r--  1 toby toby   0 Apr 16 15:50 a
-rw-r--r--  1 toby toby   0 Apr 16 15:50 foo
-rw-r--r--  1 toby toby   0 Apr 16 15:50 bar
toby@toby-pc:/tmp/test$ type ls
ls is /usr/bin/ls

toby@toby-pc:/tmp/test$ ls --version
ls (GNU coreutils) 9.4

Copyright (C) 2023 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.

Written by Richard M. Stallman and David MacKenzie.

Regards,

Toby