[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ls and non-equivalence between -1 and single-column
From: |
Eric Blake |
Subject: |
Re: ls and non-equivalence between -1 and single-column |
Date: |
Sun, 21 Dec 2008 13:36:44 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.18) Gecko/20081105 Thunderbird/2.0.0.18 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Radu Grigore on 12/21/2008 12:14 PM:
> The GNU coreutils documentation [1] suggests that "-1" and
> "--format=single-column" are equivalent, yet the following two
> commands produce different results:
> ls -l -1
> ls -l --format=single-column
> According to POSIX [2] both behaviors are correct (for "ls -l -1"), so
> I guess you need to pick one or update the docs.
>
> [1]
> http://www.gnu.org/software/coreutils/manual/html_node/General-output-formatting.html#General-output-formatting
> [2] http://www.opengroup.org/onlinepubs/009695399/utilities/ls.html
Thanks for the report. FYI, POSIX 2008 is available:
http://www.opengroup.org/onlinepubs/9699919799/utilities/ls.html
but made no changes in this regard. POSIX requires that:
ls -l
ls -1 -l
ls -l -1
behave identically (after all, a long listing is implicitly one-per-line);
but makes no requirements on how long options behave. But we want to give
the user to undo long listing, and get back to short listing. Using
solely POSIX options, there is no way to disable -l once it has been
added. Therefore, the current source code for ls uses
- --format=single-column as the way to request overriding -l, then special
cases -1 (but not --format) to not trigger --format=single-column if -l
occurred earlier in the command line.
So, since the code is intentional, the only way to solve this bug is with
a doc update.
>
> tried with: coreutils package 6.10-3ubuntu2
The latest stable release is 6.12; you can also try beta 7.0.
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAklOqNsACgkQ84KuGfSFAYB2BACeJ2gDYrrPq6JiQM6r3JPJI9OJ
SEIAoMX8/7V/Q9vrcoZdYDpvgnv1EvH+
=UVib
-----END PGP SIGNATURE-----