[Bug 446294] incorrect exit from 'ls'
bugzilla at redhat.com
bugzilla at redhat.com
Wed May 14 19:33:18 UTC 2008
Please do not reply directly to this email. All additional
comments should be made in the comments box of this bug report.
Summary: incorrect exit from 'ls'
https://bugzilla.redhat.com/show_bug.cgi?id=446294
------- Additional Comments From metcalfegreg at qwest.net 2008-05-14 15:33 EST -------
(In reply to comment #1)
> Thanks for report, the same is for upstream, rawhide and RHEL-5 coreutils. In
> source code relevant to that situation is comment
>
I won't have a Fedora > 7 for another week, but I've confirmed upstream and RHEL-5 as
well. If we don't wrap this before F7 goes off support, I'll either change the product ID to
RHEL, or confirm on a later Fedora and change to that.
> /* Failure to stat a command line argument leads to
> an exit status of 2. For other files, stat failure
> provokes an exit status of 1. */
>
> so it does mean that current behaviour is intentional. Will check a bit more
> about that - maybe change of info pages would be the best solution.
>
OK, looking at ls.c from the GNU coreutils-6.9 tarball, I think you're right about the the
coder's intent, and changing the info page being perhaps the best solution (with a
possible proviso below). Here's another example, using the specific case of a missing
subdirectory mentioned example used in info:
$ mkdir ls_test; echo $?; ls ls_test/no_dir; echo $?
0
ls: ls_test/no_dir: No such file or directory
2
The info page:
0 success
1 minor problems (e.g., a subdirectory was not found)
2 serious trouble (e.g., memory exhausted)
The man page is nonspecific enough to not be wrong. A change there would be nice, as
well, as it's currently 'not even wrong' in a literal sense. :)
I think I (and the info page author?) may have been misled by the following comment in
enum{}:
/* "ls" had a minor problem (e.g., it could not stat a directory entry). */
Consider that in the context of this last example. I'd advocate tweaks to both enum{}
comments, but I'd call it a fix if the info and man pages were changed.
Just for the sake of completeness: The Open Group Base Specifications Issue 6 (IEEE Std
1003.1, 2004 Edition) provides no guidance. All they want is exit > 0 on an error:
http://www.opengroup.org/onlinepubs/009695399/utilities/ls.html
--
Configure bugmail: https://bugzilla.redhat.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the fedora-triage-list
mailing list