bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9987: [PATCH] groups,id: add -0, --null option


From: Pádraig Brady
Subject: bug#9987: [PATCH] groups,id: add -0, --null option
Date: Thu, 19 Sep 2013 10:53:15 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 09/19/2013 08:56 AM, Bernhard Voelker wrote:
>>  On September 19, 2013 at 3:31 AM Pádraig Brady <address@hidden> 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]