On Sun, Apr 27, 2008 at 6:54 PM, Garrett Cooper <[EMAIL PROTECTED]> wrote:
> On Apr 27, 2008, at 6:37 PM, Mike Frysinger wrote: > > i'm guessing the #! change was an accident. otherwise i've incorporated > > the > > re-order and committed. > > -mike > > > > Ah, the shebang change was intentional but I forgot to remove it. /bin/sh > != /bin/bash on FreeBSD.. > Thanks, > -Garrett > [EMAIL PROTECTED] ~]# id nobody; echo $? uid=99(nobody) gid=99 groups=25(eng),15045(enged),99 1 After looking at id.c for coreutils-5.21 I tied down the issue to getgrgid(3). The errno makes absolutely no sense though, and it seems to have been "fixed" between various kernel versions: [EMAIL PROTECTED] ~]# ./getgr_t_wrapper.sh 42 ($i) not found in /etc/group 99 ($i) not found in /etc/group Error encountered with getgrgid(99): No such file or directory [EMAIL PROTECTED] ~]# uname -a Linux nova-infra-test1 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan 5 17:13:01 EST 2006 i686 i686 i386 GNU/Linux headless-horseman src # ~gcooper/getgr_t_wrapper.sh 42 ($i) not found in /etc/group Error encountered with getgrgid(42): 0, Success 99 ($i) not found in /etc/group Error encountered with getgrgid(99): 0, Success So, the moral of the story I suppose is "don't trust buggy kernels which reporting the wrong errno info via get*[gu]id". I really don't like the fact that the manpage doesn't match the expected behavior though >:(... I attached the test source files and have started an upstream discussion with the folks at kernel.org: < http://bugzilla.kernel.org/show_bug.cgi?id=10573>. -Garrett
getgr_t_wrapper.sh
Description: Bourne shell script
/* * Author: Garrett Cooper * Email: garrcoop {at} cisco {dot} com * * Description: * * A source file used in conjunction with its wrapper to help test * out the system call, getgrguid(3). * * It's been proven that this test fails on some kernel versions * (2.6.9 with RHEL-5 for instance), in particular when * getgrguid(3) != getgeguid(3). * */ #include <errno.h> #include <grp.h> #include <sys/types.h> #include <stdio.h> #include <string.h> int main(int argc, char **argv) { int i; struct group *grp; for (i = 1; i < argc; i++) { if (*(argv+i) != NULL) { if (0 < strlen( *(argv+i) )) { unsigned long gid; sscanf(*(argv+i), "%lu", &gid); if ( NULL == ( grp = getgrgid(gid)) ) { printf("Error encountered with getgrgid(%d): %d, %s\n", gid, errno, strerror(errno)); } } } } return 0; }
------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list