Ubuntu

groups script output change gutsy -> hardy

Reported by John Pybus on 2008-06-08
8
Affects Status Importance Assigned to Milestone
coreutils (Ubuntu)
Low
Unassigned

Bug Description

Binary package hint: coreutils

The output format of the groups command (from coreutils-6.10-3ubuntu2) has changed in Hardy, and this is breaking scripts which rely on parsing its output.

Expected format (as seen on Ubuntu Hardy, Debian Etch, Centos 5 and probably others):

$ groups john
john : john adm dialout cdrom floppy audio dip video plugdev lpadmin scanner admin fuse john-bu share

$ groups john root
john : john adm dialout cdrom floppy audio dip video plugdev lpadmin scanner admin fuse john-bu share
root : root

Format seen on Hardy (amd64):

$ groups john
john adm lp dialout cdrom floppy audio dip video plugdev scanner netdev lpadmin powerdev admin fuse

$ groups john root
john : john adm lp dialout cdrom floppy audio dip video plugdev scanner netdev lpadmin powerdev admin fuse
root : root

Note that groups seems to mirror id -Gn exactly when given one argument but prepend "username : " when used with multiple arguments. This is inconsistent with itself and other groups versions.

Note also that "man groups" claims "Same as id -Gn" on all tested platforms which is wrong; in general groups doesn't use the same output format.

Possible fix attached.

John Pybus (john-jpnp) wrote :
Ralph Janke (txwikinger) on 2008-06-09
Changed in coreutils:
importance: Undecided → Low
status: New → Triaged
C de-Avillez (hggdh2) wrote :

This was an upstream change, documented in the "Found and fixed bug in groups(1). Want the diff?" email thread on the coreutils mailing list. The email describing the change is in http://lists.gnu.org/archive/html/bug-coreutils/2006-09/msg00283.html, of which I pasted a piece below. The final decision will be from the Ubuntu package maintainers.

------------------------------------------
Those changes to groups.sh change its behavior to make it more
compatible with FreeBSD and Solaris. The old behavior was:

  $ groups root
  root : root

and the new behavior is:

  $ groups root
  root

I think this change is a good one (as compatibility is good), but it
should be documented.

While we're in the neighborhood:

  * "groups" should print a diagnostic if there's a write error, rather
    than merely exiting with status 1.

  * groups should handle options like "--vers" and "--" compatibly
    with everyone else.

  * "id" should be invoked with "--" to protect user names beginning
    with "-".

Here's a proposed patch. Normally I'd just install this, but you're
about to release a new version so I am holding off.

2006-09-26 Paul Eggert <address@hidden>

        * NEWS: "groups user" no longer outputs "user :"; you need at least
        two users. "groups" now processes options like --help more compatibly.
        * doc/coreutils.texi (groups invocation): "groups" no longer prefixes
        the output with "user :" unless more than one user is specified.
        * src/groups.sh: Implement the option-processing change.
        Handle user and group names with special characters more robustly.
        Report write errors instead of exiting silently with status 1.

(...)
------------------------------------------

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers