bug-coreutils
[Top][All Lists]
Advanced

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

groups additional flag


From: Reinhold Bader
Subject: groups additional flag
Date: Fri, 13 Jan 2006 16:31:36 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511

 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.

 Best regards

-- 
 Dr. Reinhold Bader

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

#!/bin/sh
# groups -- print the groups a user is in
# Copyright (C) 1991, 1997, 2000, 2002 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */

# Written by David MacKenzie <address@hidden>.

# 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
  --noinvgid    ignore invalid GIDs and suppress error

Same as id -Gn.  If no USERNAME, use current process.

Report bugs to <address@hidden>."

fail=0
ignore=0
case $# in
  1 )
    case "z${1}" in
      z--help )
         echo "$usage" || fail=1; exit $fail;;
      z--version )
         echo "groups (GNU coreutils) 5.2.1" || fail=1; exit $fail;;
      z--noinvgid )
         ignore=1
         shift;;
      * ) ;;
    esac
    ;;
  * ) ;;
esac

if [ $# -eq 0 ]; then
  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`
    status=$?
    if test $status = 0; then
      echo $name : $groups
    else
      fail=$status
    fi
  done
fi
exit $fail

reply via email to

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