On 09/19/2013 08:56 AM, Bernhard Voelker wrote:
>>  On September 19, 2013 at 3:31 AM Pádraig Brady <[email protected]> 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