GNU bug report logs - #7320
'group' command gives wrong/extra group

Previous Next

Package: coreutils;

Reported by: owen <at> illinois.edu

Date: Tue, 2 Nov 2010 21:41:01 UTC

Severity: normal

Tags: fixed

Fixed in version 8.18

Done: Jim Meyering <meyering <at> hx.meyering.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Pádraig Brady <P <at> draigBrady.com>,  Petr Stodůlka <pstodulk <at> redhat.com>
Cc: coreutils <at> gnu.org, 7320 <at> debbugs.gnu.org
Subject: bug#7320: [PATCH] 'id' prints incorrectly groups for the session
Date: Thu, 26 Jun 2014 07:44:03 +0200
On 06/26/2014 03:53 AM, Pádraig Brady wrote:
> diff --git a/tests/id/setgid.sh b/tests/id/setgid.sh
> index aa43ea3..a81b42c 100755
> --- a/tests/id/setgid.sh
> +++ b/tests/id/setgid.sh
> @@ -1,5 +1,5 @@
>  #!/bin/sh
> -# Verify that id -G prints the right group when run set-GID.
> +# Verify that id [-G] prints the right group when run set-GID.
>  
>  # Copyright (C) 2012-2014 Free Software Foundation, Inc.
>  
> @@ -27,9 +27,14 @@ gp1=$(expr $g + 1)
>  
>  echo $gp1 > exp || framework_failure_
>  
> +# With coreutils-8.16 and earlier, id -G would print both: $gp1 $g
>  chroot --user=$NON_ROOT_USERNAME:$gp1 --groups='' / env PATH="$PATH" \

shouldn't we better avoid group name resolution here?

- chroot --user=$NON_ROOT_USERNAME:$gp1 --groups='' / env PATH="$PATH" \
+ chroot --user=$NON_ROOT_USERNAME:+$gp1 --groups='' / env PATH="$PATH" \

>    id -G > out || fail=1
>  compare exp out || fail=1
> -# With coreutils-8.16 and earlier, id -G would print both: $gp1 $g
> +
> +# With coreutils-8.22 and earlier, id would erroneously print groups=$g
> +chroot --user=$NON_ROOT_USERNAME:$gp1 --groups='' / env PATH="$PATH" \

Likewise.

> +  id > out || fail=1
> +grep -F "groups=$gp1" out || fail=1
>  
>  Exit $fail

Another minor nit:
for a better diagnostic, it'd be better to use the construct
we already use in many places:

  ... || { cat out; fail=1; }

Otherwise +1.

Thanks & have a nice day,
Berny




This bug report was last modified 10 years and 331 days ago.

Previous Next


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