]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
ls: -f now means -a -U
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 17 Apr 2024 20:40:46 +0000 (13:40 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 17 Apr 2024 21:42:57 +0000 (14:42 -0700)
Problem reported by Toby Kelsey <https://bugs.gnu.org/70418>.
* src/ls.c (decode_switches): -f now simply means -a -U.
(usage): Adjust to match.

NEWS
doc/coreutils.texi
src/ls.c

diff --git a/NEWS b/NEWS
index 21ed3435b34f8a3ada9e092c0d0fbd8d32bb02c5..43ce84d7eb11f58b855217724063fe1dab97e887 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,13 @@ GNU coreutils NEWS                                    -*- outline -*-
   have exited with a "Function not implemented" error.
   [bug introduced in coreutils-8.28]
 
+** Changes in behavior
+
+  ls's -f option now simply acts like -aU, instead of also ignoring
+  some earlier options.  For example 'ls -fl' and 'ls -lf' are now
+  equivalent because -f no longer ignores an earlier -l.  The new
+  behavior is more orthogonal and is compatible with FreeBSD.
+
 ** Improvements
 
   sort operates more efficiently when used on pseudo files with
index 8f7f43ea07554412b825efce2004be40f1a2c4c9..2c6c8b68bbe480cc905b94c2649d9730119472a8 100644 (file)
@@ -8150,11 +8150,9 @@ sort according to the ctime.  @xref{File timestamps}.
 @opindex -f
 @cindex unsorted directory listing
 @cindex directory order, listing by
-Produce an unsorted directory listing.
-This is like @option{--sort=none} (@option{-U}),
-but also enable @option{--all} (@option{-a}),
-while also disabling any previous use of @option{-l}, @option{--color}
-@option{--size}, or @option{--hyperlink}.
+Produce an unsorted listing of all directory entries.
+This is like @option{--all} (@option{-a}) combined
+with @option{--sort=none} (@option{-U}).
 
 @item -r
 @itemx --reverse
@@ -8224,10 +8222,12 @@ sort according to the birth time.
 @opindex --sort
 @opindex none@r{, sorting option for @command{ls}}
 Do not sort; list the files in whatever order they are
-stored in the directory.  (Do not do any of the other unrelated things
-that @option{-f} does.)  This can be useful when listing large
+stored in the directory.  This can be useful when listing large
 directories, where sorting can take some time.
 
+Unlike @option{-f}, this option does not imply @option{--all}
+(@option{-a}).
+
 @item -v
 @itemx --sort=version
 @opindex -v
index f5ac98df7d872c7fce30b3de68b7617300c5a792..916d7c0508cbba2342f18f195f830db82cd0163e 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -1952,11 +1952,6 @@ decode_switches (int argc, char **argv)
         case 'f':
           ignore_mode = IGNORE_MINIMAL; /* enable -a */
           sort_opt = sort_none;         /* enable -U */
-          if (format_opt == long_format)
-            format_opt = -1;            /* disable -l */
-          print_with_color = false;     /* disable --color */
-          print_hyperlink = false;      /* disable --hyperlink */
-          print_block_size = false;     /* disable -s */
           break;
 
         case FILE_TYPE_INDICATOR_OPTION: /* --file-type */
@@ -5466,7 +5461,7 @@ Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n\
   -D, --dired                generate output designed for Emacs' dired mode\n\
 "), stdout);
       fputs (_("\
-  -f                         do not sort, enable -aU, disable -ls --color\n\
+  -f                         same as -a -U\n\
   -F, --classify[=WHEN]      append indicator (one of */=>@|) to entries WHEN\n\
       --file-type            likewise, except do not append '*'\n\
 "), stdout);