[Toybox] [PATCH] id: various fixes.

enh enh at google.com
Mon Nov 4 20:56:49 PST 2019


On Mon, Nov 4, 2019 at 8:12 PM Rob Landley <rob at landley.net> wrote:
>
>
>
> On 11/4/19 12:43 PM, enh via Toybox wrote:
> > Handle unknown groups (fixes #117).
> >
> > Fix -G to show *all* groups, not just all supplementary groups.
> >
> > Fix -Z output to not include "context=".
>
> Sigh:
>
> -  if (!FLAG(Z)) {
> +  if (!(toys.optflags&(FLAG_g|FLAG_Z))) {
>
> I need some kind of FLAGS(Z,g) syntax, but have no idea how to get the
> preprocessor to do that. Hmmm...

funnily enough, in this specific case we can rearrange the code a bit
and remove these completely. i'll send you a patch.

> +        if (groups[i] != egid) {
> +          if ((grp=getgrgid(groups[i]))) showid(",", grp->gr_gid, grp->gr_name);
> +          else printf(",%u", groups[i]);
>
> Does this mean if the first group you show is unknown, it'll have a comma before it?

no. there's an unconditional call to showid for the primary group
above the loop, so there's alway been something printed.

> Applied anyway,
>
>
> Rob
>
>
> > ---
> >  tests/id.test   |  3 +++
> >  toys/posix/id.c | 53 +++++++++++++++++++++----------------------------
> >  2 files changed, 26 insertions(+), 30 deletions(-)
> >
> >
> > _______________________________________________
> > Toybox mailing list
> > Toybox at lists.landley.net
> > http://lists.landley.net/listinfo.cgi/toybox-landley.net
> >



More information about the Toybox mailing list