]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
[ChangeLog]
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 26 Sep 2006 19:11:25 +0000 (19:11 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 26 Sep 2006 19:11:25 +0000 (19:11 +0000)
* NEWS: "groups user" no longer outputs "user :"; you need at least
two users.  "groups" now processes options like --help more compatibly.
* 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.
[doc/ChangeLog]
* coreutils.texi (groups invocation): "groups" no longer prefixes
the output with "user :" unless more than one user is specified.

ChangeLog
NEWS
doc/ChangeLog
doc/coreutils.texi
src/groups.sh

index 7004dca4bdfb04ee0d0db34f80a156e80cc62311..1f31f0886f6ecb2032b2599db63b70bfc5ca4a5a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-09-26  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * NEWS: "groups user" no longer outputs "user :"; you need at least
+       two users.  "groups" now processes options like --help more compatibly.
+       * 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.
+
 2006-09-26  Jim Meyering  <jim@meyering.net>
 
        * README: Warn not to run autoreconf manually.  Use bootstrap instead.
diff --git a/NEWS b/NEWS
index 50fbcc5f7bb0544a763370090941ca611d545766..815b0762a24bad371ee498e4ad0de30d04672f9c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -22,8 +22,14 @@ GNU coreutils NEWS                                    -*- outline -*-
   With --verbose (-v), cp and mv would sometimes generate no output,
   or neglect to report file removal.
 
-  "groups user" now exits nonzero when it gets a write error.
+  For the "groups" command:
 
+    "groups" no longer prefixes the output with "user :" unless more
+    than one user is specified; this is for compatibility with BSD.
+
+    "groups user" now exits nonzero when it gets a write error.
+
+    "groups" now processes options like --help more compatibly.
 
 * Major changes in release 6.2 (2006-09-18) [stable candidate]
 
index 10e4109d77fcd438ed6296ccda12b07cfdd8798e..2867798b0eb56660d39103507ad7bebff7ed128e 100644 (file)
@@ -1,3 +1,8 @@
+2006-09-26  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * coreutils.texi (groups invocation): "groups" no longer prefixes
+       the output with "user :" unless more than one user is specified.
+
 2006-09-19  Paul Eggert  <eggert@cs.ucla.edu>
 
        * coreutils.texi (cp invocation): Say that -i and -f are
index bcc336f605c230fc2ba89180ddb82b6481716c85..3a180f66949be4edc1986d8f1dbd028c81f78256 100644 (file)
@@ -11973,7 +11973,8 @@ options}.
 
 @command{groups} prints the names of the primary and any supplementary
 groups for each given @var{username}, or the current process if no names
-are given.  If names are given, the name of each user is printed before
+are given.  If more than one name is given, the name of each user is
+printed before
 the list of that user's groups.  Synopsis:
 
 @example
index 43395d710d03ab4b53e40b3b7b53db9e9576b0e5..decbe6aafd3647f03eaf0ea6d9c059295d9ccdd8 100755 (executable)
@@ -34,36 +34,49 @@ Report bugs to <@PACKAGE_BUGREPORT@>."
 version='groups (@GNU_PACKAGE@) @VERSION@
 Written by David MacKenzie.
 
-Copyright (C) 2004 Free Software Foundation, Inc.
+Copyright (C) 2006 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.'
 
 
-fail=0
-case $# in
-  1 )
-    case "z${1}" in
-      z--help )
-        echo "$usage" || fail=1; exit $fail;;
-      z--version )
-        echo "$version" || fail=1; exit $fail;;
-      * ) ;;
-    esac
-    ;;
-  * ) ;;
-esac
+for arg
+do
+  case $arg in
+    --help | --hel | --he | --h)
+      exec echo "$usage" ;;
+    --version | --versio | --versi | --vers | --ver | --ve | --v)
+      exec echo "$version" ;;
+    --)
+      shift
+      break ;;
+    -*)
+      echo "$0: invalid option: $arg" >&2
+      exit 1 ;;
+  esac
+done
 
 # With fewer than two arguments, simply exec "id".
 case $# in
-  0|1) exec id -Gn "$@" ;;
+  0|1) exec id -Gn -- "$@" ;;
 esac
 
 # With more, we need a loop, and be sure to exit nonzero upon failure.
-for name in "$@"; do
-  if groups=`id -Gn -- $name`; then
-    echo $name : $groups || fail=1
+status=0
+write_error=0
+
+for name
+do
+  if groups=`id -Gn -- "$name"`; then
+    echo "$name : $groups" || {
+      status=$?
+      if test $write_error = 0; then
+       echo "$0: write error" >&2
+       write_error=1
+      fi
+    }
   else
-    fail=1
+    status=$?
   fi
 done
-exit $fail
+
+exit $status