[Toybox] Two patches for two toys.

Rob Landley rob at landley.net
Sat Sep 27 08:22:11 PDT 2014



On 09/22/14 03:31, luckboy at vp.pl wrote:
> I found some bug in the killall toy and the id toy, and then fixed they.
> First patch bug that when killall was invoked without arguments, there
> appeared segmentation fault. Patch for killall toy:
> 
> https://github.com/luckboy/toyroot/blob/master/patch/toybox-0.4.9-fixed-killall.patch

I already applied that one...

> Second patch fixes bug that id didn't display the whitespace between
> first group and
> second group when it is invoked without options. Patch for id toy:
> 
> https://github.com/luckboy/toyroot/blob/master/patch/toybox-0.4.9-fixed-id.patch

$ ./id
adm cdrom sudo dip plugdev lpadmin sambashare landley
$ id
uid=1000(landley) gid=1000(landley)
groups=1000(landley),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),110(lpadmin),123(sambashare)
$

That's a slight difference in behavior regardless of... Ah, I see,
scripts/single.sh is glitching again. (It's creating a 4 entry array for
the enabled commands, alphebetizing it, and then always thinks it's
running "groups" because that's first.)

I think the right fix for this issue is probably:

@@ -116,7 +123,7 @@
   if (ngroups<0) perror_exit(0);

   for (i = 0; i<ngroups; i++) {
-    if (i) xputc(' ');
+    if (i || !(flags & FLAG_G)) xputc(' ');
     if (!(grp = getgrgid(groups[i]))) perror_msg(0);
     else if (flags & FLAG_G) s_or_u(grp->gr_name, grp->gr_gid, 0);
     else if (grp->gr_gid != egid) showid("", grp->gr_gid, grp->gr_name);

But I've gone off on a tangent trying to fix the single.sh build...

Rob

 1411831331.0


More information about the Toybox mailing list