[Toybox] [Patches] - Some more static analysis fixes

David Seikel onefang at gmail.com
Mon Oct 13 22:51:20 PDT 2014


On Tue, 14 Oct 2014 00:38:27 -0500 Rob Landley <rob at landley.net> wrote:

> On 10/07/14 00:50, Ashwini Sharma wrote:
> > Hi Rob, List,
> > 
> > Attached are few more static analysis fixes. This includes issues
> > like resource leaks, logical dead codes etc...
> 
> The reason I didn't do this bit in lib.c:
> 
> -    if (!pidstr) xputs(signames[i].name);
> +    if (!pidstr) xprintf("%02d) %s\n", signames[i].num,
> signames[i].name);
> 
> Is that posix kill.html says for -l "Write all values of signal_name
> supported by the implementation, if no operand is given." (And then
> for -s it says signal_name is a symbolic name.)
> 
> The "number) name" syntax provides more information to humans, but A)
> is less scriptable (can't do "for i in $(kill -l)" from the shell),
> B) not what posix requires.
> 
> Note that if you go "POSIXLY_CORRECT=1 kill -l" the gnu/dammit
> version will spit out just the names, not the numbers.
> 
> *shrug* I can do it the other way if that's what people really
> prefer, just pointing out I had reasons for _not_ doing that. (And
> I'm not interested in reading a POSIXLY_CORRECT variable. Either
> we're compliant with the standard or we aren't, pick one.
> 
> Being more scriptable pushed me over to standards compliance because
> you can do a trivial one liner:
> 
> for i in $(./toybox kill -l); do echo $(./toybox kill -l $i)") "$i;
> done | sort -n
> 
> So implementing the standard doesn't actually make it hard to get
> this information...

Unless there's a significant number of scripts out there making
gnu/dammit the defacto standard for this, go with a real standard,
POSIX.  Though I would guess that if the gnu/damit method isn't
as easily scriptable, then there might be less scripts using it, so no
worries.  B-)

-- 
A big old stinking pile of genius that no one wants
coz there are too many silver coated monkeys in the world.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20141014/207b8827/attachment.pgp>


More information about the Toybox mailing list