From 9ab1f9db94479eca4dd2c29b4e21550ff2bcd5bb Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 17 Apr 2024 13:40:46 -0700 Subject: [PATCH] ls: -f now means -a -U Problem reported by Toby Kelsey . * src/ls.c (decode_switches): -f now simply means -a -U. (usage): Adjust to match. --- NEWS | 7 +++++++ doc/coreutils.texi | 14 +++++++------- src/ls.c | 7 +------ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/NEWS b/NEWS index 21ed3435b..43ce84d7e 100644 --- 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 diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 8f7f43ea0..2c6c8b68b 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -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 diff --git a/src/ls.c b/src/ls.c index f5ac98df7..916d7c050 100644 --- 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); -- 2.11.4.GIT