bug-coreutils
[Top][All Lists]
Advanced

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

Re: groups additional flag


From: Reinhold Bader
Subject: Re: groups additional flag
Date: Mon, 16 Jan 2006 11:18:25 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511

Hello Eric,

  I am attaching a "diff -u oldfile newfile" output against the 5.93 script.
  I consider the change only a very slight one, so (I hope) no copyright
  assignment will be necessary.

Best regards


Eric Blake wrote:
> According to Reinhold Bader on 1/13/2006 8:31 AM:
>>> Dear coreutils maintainers,
>>>
>>>   I am attaching a modified version of /usr/bin/groups which allows to 
>>> suppress
>>>   errors resulting from the occurrence of artificial GIDs which are used
>>>   for authentification purposes. These errors cause difficulties e. g. in 
>>> Tcl
>>>   scripts using groups via exec.
>>>
>>>   May I ask for inclusion in the standard distribution tree?
>>>   The basis used was the 5.2.1 coreutils release as used in Novell's SLES9
>>>   distribution.
> 
> 
> Thanks for the ideas.  However, could you please regenerate this as a
> unified diff against a more current distribution (the current stable
> release is 5.93, and the CVS development is progressing towards an
> eventual 6.0 release), rather than as a straight file?  Also, your changes
> may be large enough that it would require copyright assignment, if it is
> indeed worth applying the patch.  Without anything to compare against, it
> is not obvious what you are trying to add.
> 
> --
> Life is short - so eat dessert first!
> 
> Eric Blake             address@hidden

-- 
 Dr. Reinhold Bader

 Leibniz-Rechenzentrum, Abt. Hochleistungssysteme | Tel. +49 89 289 28825
 Barerstr. 21, 80333 Muenchen                     | email address@hidden

--- groups      2006-01-16 11:10:41.205278000 +0100
+++ groups_noerr        2006-01-16 11:14:06.557536000 +0100
@@ -20,12 +20,16 @@
 
 # Make sure we get GNU id, if possible; also allow
 # it to be somewhere else in PATH if not installed yet.
+#
+# LRZ fix: add switch to ignore errors induced by artificial GIDs without
+# /etc/group entry.
 PATH=/usr/bin:$PATH
 
 usage="Usage: $0 [OPTION]... [USERNAME]...
 
-  --help      display this help and exit
-  --version   output version information and exit
+  --help        display this help and exit
+  --version     output version information and exit
+  --noinvgid    ignore invalid GIDs and suppress error
 
 Same as id -Gn.  If no USERNAME, use current process.
 
@@ -40,6 +44,7 @@
 
 
 fail=0
+ignore=0
 case $# in
   1 )
     case "z${1}" in
@@ -47,6 +52,9 @@
         echo "$usage" || fail=1; exit $fail;;
       z--version )
         echo "$version" || fail=1; exit $fail;;
+      z--noinvgid )
+        ignore=1
+         shift;;
       * ) ;;
     esac
     ;;
@@ -54,8 +62,18 @@
 esac
 
 if [ $# -eq 0 ]; then
-  id -Gn
-  fail=$?
+  if [ $ignore -eq 0 ] ; then
+    id -Gn
+    fail=$?
+  else
+    groups=$(id -Gn -- $(whoami))
+    status=$?
+    if test $status = 0; then
+      echo $groups
+    else
+      fail=$status
+    fi
+  fi
 else
   for name in "$@"; do
     groups=`id -Gn -- $name`

reply via email to

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