GNU bug report logs - #9987
RFE: 'groups' command ADD command switches "-0", and "-1"

Previous Next

Package: coreutils;

Reported by: Linda Walsh <coreutils <at> tlinx.org>

Date: Mon, 7 Nov 2011 22:31:01 UTC

Severity: normal

Merged with 12083

Done: Bernhard Voelker <mail <at> bernhard-voelker.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Pádraig Brady <P <at> draigBrady.com>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: 9987 <at> debbugs.gnu.org
Subject: bug#9987: [PATCH] groups,id: add -0, --null option
Date: Thu, 19 Sep 2013 10:53:15 +0100
On 09/19/2013 08:56 AM, Bernhard Voelker wrote:
>>  On September 19, 2013 at 3:31 AM Pádraig Brady <P <at> draigBrady.com> wrote:

>>  Also why so many (100). The test is a bit slow and you would get
>>  the same coverage from a couple of entries?
> 
> Actually that was to protect against "very-expensive" behavior on
> bigger NIS installation. On normal installations, I haven't seen much
> more than 30-40 users yet anyway.

Yep that's still noticeable here.

> The point was to get an entry with only 1 and with 2 or more groups.
> I wouldn't go that far and add require_membership_in_two_groups_,
> so maybe finding such entries with something like this would be better

Oh I see. That need for 'root' definitely wasn't obvious and needs a comment.
With tests we have greater flexibility in that the common case can cater for
the coverage, while we can gracefully degrade the test on outliers.
So I'd avoid getent entirely and do:

# Add $USER to ensure we have at least one explicit entry
users="$u"
# Add 'root' to test multiple groups (as is usually the case)
id root >/dev/null 2>/dev/null && users="$USERS root"
# Add 'nobody' to test single group (as is usually the case)
id nobody >/dev/null 2>/dev/null && users="$USERS nobody"
# Add $users and '' (implicit $USER) to list to process
printf '%s\n' $users '' >> users || framework_failure_

> (btw: can we rely on xargs to be there)?

I see that xargs has been used since 2004 without issue.

thanks,
Pádraig.




This bug report was last modified 11 years and 299 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.