[Toybox] [PATCH] ls.c: match coreutils exit status.

Rob Landley rob at landley.net
Sun Nov 3 17:16:00 PST 2019


On 10/31/19 11:50 AM, enh via Toybox wrote:
> Andrew Ilijic noticed that our ls exit status differs from coreutils
> while writing tests. From coreutils' `ls --help`:
> 
>  0  if OK,
>  1  if minor problems (e.g., cannot access subdirectory),
>  2  if serious trouble (e.g., cannot access command-line argument).
> 
> Invalid/unknown command-line arguments count as 2.

I agree it's a difference, but what is the impact? Did any script anywhere use
this, or are we changing it just because we can? What is the rule for what the
return codes mean? (Are we switching from posix to the man pages as our standard?)

As for _this_ one, what's the definition of "minor" vs "serious"? If we "ls *"
and there's 300 things, one of which is a subdirectory we can't access, this is
both minor and serious. And we're adding behavior that we care about enough to
test but not mentioning it in the help output, not that I _want_ to make
multiple commands' help output bigger...

It's not a big change, I just don't understand what the motivation for it is.
It's an increase (2 new lines and a macro) in code complexity rather than an
equivalent substitution, and it's the half-dozenth return to this topic so far
over an 8 month period, and I'd like to be able to enunciate what we're trying
to accomplish here and put it in design.html or something.

Rob



More information about the Toybox mailing list