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

2019-11-03 Thread Rob Landley
On 11/3/19 11:18 PM, enh wrote: >> 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 accomplis

Re: [Toybox] Testing: how to check return code

2019-11-03 Thread Jarno Mäkipää
Hi Tested ls with invalid options on freebsd and it returns only 0 or 1 and never 2. And quick look at source confirms my test... So returning 2 is gnuism. I dont see any actual use case for writing script with invalid argument and checking specific return code? On Mon, Nov 4, 2019 at 3:07 AM Ro

Re: [Toybox] [PATCH] id: support numeric lookup.

2019-11-03 Thread enh via Toybox
On Sun, Nov 3, 2019 at 5:19 PM Rob Landley wrote: > > On 11/3/19 1:04 AM, enh via Toybox wrote: > > Fall back to converting the "name" to an integer and calling getpwuid(). > > We need to update `username` for the later call to getgrouplist(). > > > > Also fix the separator printing logic to avoid

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

2019-11-03 Thread enh via Toybox
On Sun, Nov 3, 2019 at 5:13 PM Rob Landley wrote: > > 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 subdire

[Toybox] I've introduced you to kisslinux

2019-11-03 Thread scsijon
Hope you don't mind this, their posix based. The url is https://github.com/kisslinux/repo/issues/113 , with the main page at https://getkiss.org/. ___ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.ne

Re: [Toybox] [PATCH] id: support numeric lookup.

2019-11-03 Thread Rob Landley
On 11/3/19 1:04 AM, enh via Toybox wrote: > Fall back to converting the "name" to an integer and calling getpwuid(). > We need to update `username` for the later call to getgrouplist(). > > Also fix the separator printing logic to avoid a trailing ',' on `id 0`. > > Switch to FLAG() and move some

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

2019-11-03 Thread Rob Landley
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-li

Re: [Toybox] Testing: how to check return code

2019-11-03 Thread Rob Landley
On 10/30/19 1:56 PM, enh via Toybox wrote: >> I am with you enh. In this case, I wanted the error code because >> GNU `ls` says the command can exit with { 0, 1, 2 }. >> https://linux.die.net/man/1/ls >> POSIX says exit status is { 0, >0 } >> https://pubs.opengroup.org/onlinepubs/9699919799/ >> In

Re: [Toybox] Testing: how to check return code

2019-11-03 Thread Rob Landley
On 10/30/19 11:34 AM, enh via Toybox wrote: > as someone who likes to see the specific exit value (because it's less > ambiguous when you see it in a failure than "yes" or "ok" or > whatever)... Yes but the question then becomes what you're testing for. Is "returns 37 in this case" part of the spe