ls: -f now means -a -U

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.
This commit is contained in:
Paul Eggert 2024-04-17 13:40:46 -07:00
parent a9b78541fa
commit 9ab1f9db94
3 changed files with 15 additions and 13 deletions

7
NEWS
View File

@ -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

View 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

View File

@ -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);