grady@fxgrp.fx.com (Steven Grady) (09/21/89)
Does anyone know the correct configuration of the Makefile to get bash to compile on a pc/rt running AIX 2.2.1? I tried using OS=SYSV (confused by the existence of sys/wait.h) and OS=Bsd with the bsd compatibility library (got confused by NGROUPS. I can probably get it compiled, but I wanted to check if anyone else had done so.. BTW, on the PC/RT, NGROUPS (from /usr/include/grp.h) is 64*1024, which is a little bigger than on most bsd machines (16). Perhaps the group_member() function should have some conditional cpp lines in there to try using a smaller size, if necessary. (Who needs 256k of data taken up for such a stupid function?) Steven ...!ucbvax!grady grady@postgres.berkeley.edu "Say, isn't that a twenty-story-high Gumby-shaped robot approaching at about Mach 8?" "What do you know...? So it is."
bfox@AUREL.CALTECH.EDU (Brian Fox) (09/22/89)
Date: 21 Sep 89 03:48:27 GMT From: fxgrp!news@AMES.ARC.NASA.GOV (Steven Grady) Organization: FXDevelopment, Mountain View, CA Sender: bug-bash-request@prep.ai.mit.edu Does anyone know the correct configuration of the Makefile to get bash to compile on a pc/rt running AIX 2.2.1? I tried using OS=SYSV (confused by the existence of sys/wait.h) and OS=Bsd with the bsd compatibility library (got confused by NGROUPS. I can probably get it compiled, but I wanted to check if anyone else had done so.. BTW, on the PC/RT, NGROUPS (from /usr/include/grp.h) is 64*1024, which is a little bigger than on most bsd machines (16). Perhaps the group_member() function should have some conditional cpp lines in there to try using a smaller size, if necessary. (Who needs 256k of data taken up for such a stupid function?) Here is a version of group_member () (in execute_cmd.c) which should solve your woes. #ifndef SYSV /* The number of groups (within 64) that this user is a member of. */ static int default_group_array_size = 0; static int ngroups = 0; static int *group_array = (int *)NULL; #endif /* SYSV */ /* Return non-zero if GID is one that we have in our groups list. */ group_member (gid) int gid; { #ifdef SYSV return ((gid == getgid ()) || (gid == geteuid ())); #else register int i; /* getgroups () returns the number of elements that it was able to place into the array. We simply continue to call getgroups () until the number of elements placed into the array is smaller than the physical size of the array. */ while (ngroups == default_group_array_size) { default_group_array_size += 64; if (!group_array) group_array = (int *)xmalloc (default_group_array_size * sizeof (int)); else group_array = (int *)xrealloc (group_array, default_group_array_size * sizeof (int)); ngroups = getgroups (default_group_array_size, group_array); } /* In case of error, the user loses. */ if (ngroups < 0) return (0); /* Search through the list looking for GID. */ for (i = 0; i < ngroups; i++) if (gid == group_array[i]) return (1); return (0); #endif /* SYSV */ }