[comp.lang.perl] t/op/groups.t fails

gerry@jts.com (G. Roderick Singleton ) (04/23/91)

The only test that fails is this one.  Fro the record here's the
text of the test:


	#!./perl
	
	if (! -x '/usr/ucb/groups') {
	    print "1..0\n";
	    exit 0;
	}
	
	print "1..1\n";
	
	for (split(' ', $()) {
	    next if $seen{$_}++;
	    push(@gr, (getgrgid($_))[0]); 
	} 
	$gr1 = join(' ',sort @gr);
	$gr2 = join(' ', sort split(' ',`groups`));
	print "gr1 is <$gr1>\n";
	print "gr2 is <$gr2>\n";
	print +($gr1 eq $gr2) ? "ok 1\n" : "not ok 1\n";

As I read this it uses a built-in, getgrpid() to get the various
groups then uses /usr/ucb/groups to get a "system level list" and
compares the two arrays.

Now the ISI4.3(NFS+YP) version of groups graps the ypmap for groups.
Needless to say when groups.t is executed it fails.  So before
I go and install I like some help analyzing the problem and perhaps
getting a soluution,even.  I'm a relative neophyte at perl so
I'd prefer not to play with the internals without more information.
Ho 'bout it?

ger
-- 
G. Roderick Singleton, System and Network Manager, JTS Computers 
{yunexus | uunet | geac | torsqnt}!gerry@jtsv16.jts.com

dnb@meshugge.media.mit.edu (David N. Blank) (04/23/91)

> t/op/groups.t fails

Howdy-
    I had a problem similar to yours on a Decstation 5000.  Turns out
that I was compiling on a machine which did not have the group id
found in the passwd file listed in the /etc/group file.  As a result,
the system call getgroups() and the UNIX command 'groups' gave
different results, forcing that test to fail.  As soon as I added an
entry to /etc/group with my group, everything was peachy.  The way I
wound up debugging this was to a) run the command 'groups' and b)
uncomment out the lines (which were commented out in my version:

> 	print "gr1 is <$gr1>\n"; 
> 	print "gr2 is <$gr2>\n";

When they returned two different values, I knew something was fishy.
Hope this helps.
                 Peace,
                   dNb

P.S. Perhaps The Author might want to make that test a bit more robust
by checking for this condition.
--

 David N. Blank                      o/    \  /    \ /     /      \o   
 M.I.T. Media Laboratory            /#      ##o     #     o##      #\
 E15-473F, (617) 253-2169           / \    /  \    /o\    / |\    / \

tell@oscar.cs.unc.edu (Stephen Tell) (04/23/91)

In article <1991Apr22.212847.3788@jts.com> gerry@jts.com (G. Roderick Singleton ) writes:

You don't say exactly what kind of system you're using, but I had
this test fail on SunOS 4.1 when Configure got "gidtype" wrong.
Rummaging through the include files, I found I needed to set
gidtype='gid_t'

I was compiling with the SysV environment.

According to comments in /usr/5include/grp.h,
POSIX wants one size of gid_t, and BSD wants another.  I forget
which is which; one is short (16 bits), the other int (32 bits).

I had similar problems on Dec/Mips machines.
The usual symptom of getting the size wrong is spurious/missing
groups from perls builtins.

Configure probably has trouble wading through the various includes and
#ifdefs that specify things for the various environments.

I haven't had time to do 4.003 yet, so I don't know if the hints work.


Steve

>G. Roderick Singleton, System and Network Manager, JTS Computers 
>{yunexus | uunet | geac | torsqnt}!gerry@jtsv16.jts.com


-- 
Steve Tell       tell@cs.unc.edu    H: +1 919 968 1792   #5L Estes Park apts
CS Grad Student, UNC Chapel Hill.   W: +1 919 962 1845   Carrboro NC 27510
Duke Blue Devils:  1991 NCAA Basketball National Champions! We're Number 1 !!
UNLV 90-91 record:  "34 and DUKE."  

gerry@jts.com (G. Roderick Singleton ) (04/25/91)

In article <DNB.91Apr23015436@meshugge.media.mit.edu> dnb@meshugge.media.mit.edu (David N. Blank) writes:
>> t/op/groups.t fails
>
>Howdy-
>    I had a problem similar to yours on a Decstation 5000.  Turns out
>that I was compiling on a machine which did not have the group id
>found in the passwd file listed in the /etc/group file.  As a result,
	[stuff deleted]

>                 Peace,
>                   dNb

Did all that but I guess I didn't provide sufficient detail. So I've
added details below.

>
>P.S. Perhaps The Author might want to make that test a bit more robust
>by checking for this condition.

Please, Larry!

Now for some more information:
My ISI is running IS68K 4.3BSD UNIX: 4.1A with nfs and "yellowpages".
This, in itself, should make things easier but ISI's getgrgid(),
getgroups() and /usr/ucb/groups, all seem to handle the yp maps
differently hence groups.t fails. I have no source licence so fixing
the primatives is out of the question.

Does anyone, especially Larry, have a workaround/solution
for this?

I'm concerned because on my other servers (sun386is/SunOS4.0.2,
sun3s/SunOS4.0.3 and sun4s/SunOS4.1.1) perl seems to compile execute
correctly.  Thus perl on the ISI must execute the same perl scripts as
the others and produce exactly the same results, at least if I have my
druthers.

Any and all help gratefully accepted.

ger
-- 
G. Roderick Singleton, System and Network Manager, JTS Computers 
{yunexus | uunet | geac | torsqnt}!gerry@jtsv16.jts.com