Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken test t/op/groups.t #12776

Closed
p5pRT opened this issue Feb 16, 2013 · 13 comments
Closed

Broken test t/op/groups.t #12776

p5pRT opened this issue Feb 16, 2013 · 13 comments

Comments

@p5pRT
Copy link

p5pRT commented Feb 16, 2013

Migrated from rt.perl.org#116775 (status was 'resolved')

Searchable as RT116775$

@p5pRT
Copy link
Author

p5pRT commented Feb 16, 2013

From Gryllida@gmail.com

This is a bug report for perl from Gryllida@​gmail.com,
generated with the help of perlbug 1.39 running under perl 5.16.2.


Installing Perl 5.16.2 using perlbrew, t/op/groups.t fails​:

op/groups.t (Wstat​: 0 Tests​: 1 Failed​: 0)
  Parse errors​: Tests out of sequence. Found (2) but expected (1)
  Bad plan. You planned 2 tests but ran 1.

Running it separately produces an output without a 'ok 1' or 'not ok 1' note for test 1​:

gry@​localhost​:~/perl5/perlbrew/build/perl-5.16.2$ ./perl t/op/groups.t
# groups =uid=1000(gry) gid=1000(gry) groups=27(sudo),1000(gry)
# gr =27(sudo),1000(gry)
# g =27(sudo),1000(gry)
# ex_gr =sudo,gry
# pwgid=1000 pwgnam=gry $(=1000 1000
# gr_name =gry,gry
1..2
ok 2
gry@​localhost​:~/perl5/perlbrew/build/perl-5.16.2$



Flags​:
  category=core
  severity=medium


Site configuration information for perl 5.16.2​:

Configured by gry at Fri Feb 15 16​:18​:00 PST 2013.

Summary of my perl5 (revision 5 version 16 subversion 2) configuration​:
 
  Platform​:
  osname=linux, osvers=2.6.32-5-686-bigmem, archname=i686-linux
  uname='linux localhost 2.6.32-5-686-bigmem #1 smp wed jan 12 04​:40​:25 utc 2011 i686 gnulinux '
  config_args='-de -Dprefix=/home/gry/perl5/perlbrew/perls/perl-5.16.2 -Aeval​:scriptdir=/home/gry/perl5/perlbrew/perls/perl-5.16.2/bin'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=undef, usemultiplicity=undef
  useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
  use64bitint=undef, use64bitall=undef, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
  optimize='-O2',
  cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
  ccversion='', gccversion='4.4.5', gccosandvers=''
  intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
  ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
  alignbytes=4, prototype=define
  Linker and Libraries​:
  ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
  libpth=/usr/local/lib /lib/../lib /usr/lib/../lib /lib /usr/lib /usr/lib64
  libs=-lnsl -ldl -lm -lcrypt -lutil -lc
  perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
  libc=/lib/libc-2.11.3.so, so=so, useshrplib=false, libperl=libperl.a
  gnulibc_version='2.11.3'
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
  cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'

Locally applied patches​:
 


@​INC for perl 5.16.2​:
  /home/gry/perl5/perlbrew/perls/perl-5.16.2/lib/site_perl/5.16.2/i686-linux
  /home/gry/perl5/perlbrew/perls/perl-5.16.2/lib/site_perl/5.16.2
  /home/gry/perl5/perlbrew/perls/perl-5.16.2/lib/5.16.2/i686-linux
  /home/gry/perl5/perlbrew/perls/perl-5.16.2/lib/5.16.2
  .


Environment for perl 5.16.2​:
  HOME=/home/gry
  LANG=en_US.UTF-8
  LANGUAGE (unset)
  LC_ADDRESS=en_AU.UTF-8
  LC_IDENTIFICATION=en_AU.UTF-8
  LC_MEASUREMENT=en_AU.UTF-8
  LC_MONETARY=en_AU.UTF-8
  LC_NAME=en_AU.UTF-8
  LC_NUMERIC=en_AU.UTF-8
  LC_PAPER=en_AU.UTF-8
  LC_TELEPHONE=en_AU.UTF-8
  LC_TIME=en_AU.UTF-8
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/home/gry/perl5/perlbrew/bin​:/home/gry/perl5/perlbrew/perls/perl-5.16.2/bin​:/usr/local/bin​:/usr/bin​:/bin​:/usr/local/games​:/usr/games
  PERLBREW_BASHRC_VERSION=0.58
  PERLBREW_HOME=/home/gry/.perlbrew
  PERLBREW_MANPATH=/home/gry/perl5/perlbrew/perls/perl-5.16.2/man
  PERLBREW_PATH=/home/gry/perl5/perlbrew/bin​:/home/gry/perl5/perlbrew/perls/perl-5.16.2/bin
  PERLBREW_PERL=perl-5.16.2
  PERLBREW_ROOT=/home/gry/perl5/perlbrew
  PERLBREW_VERSION=0.58
  PERL_BADLANG (unset)
  SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Feb 16, 2013

From @jkeenan

On Fri Feb 15 18​:14​:34 2013, Gryllida wrote​:

This is a bug report for perl from Gryllida@​gmail.com,
generated with the help of perlbug 1.39 running under perl 5.16.2.

-----------------------------------------------------------------
Installing Perl 5.16.2 using perlbrew, t/op/groups.t fails​:

op/groups.t
(Wstat​: 0 Tests​: 1 Failed​: 0)
Parse errors​: Tests out of sequence. Found (2) but expected (1)
Bad plan. You planned 2 tests but ran 1.

Running it separately produces an output without a 'ok 1' or 'not ok
1' note for test 1​:

gry@​localhost​:~/perl5/perlbrew/build/perl-5.16.2$ ./perl t/op/groups.t
# groups =uid=1000(gry) gid=1000(gry) groups=27(sudo),1000(gry)
# gr =27(sudo),1000(gry)
# g =27(sudo),1000(gry)
# ex_gr =sudo,gry
# pwgid=1000 pwgnam=gry $(=1000 1000
# gr_name =gry,gry
1..2
ok 2
gry@​localhost​:~/perl5/perlbrew/build/perl-5.16.2$

This may be the same issue as
https://rt-archive.perl.org/perl5/Ticket/Display.html?id=71508.  Could we get a
second pair of eyes on both tickets to confirm that?

Thank you very much.
Jim Keenan

@p5pRT
Copy link
Author

p5pRT commented Feb 16, 2013

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Feb 17, 2013

From @demerphq

Josh are you able to look into this? As far as I know the last patch
was from you and was quite significant.

Cheers,
Yves

On 17 February 2013 00​:17, James E Keenan via RT
<perlbug-followup@​perl.org> wrote​:

On Fri Feb 15 18​:14​:34 2013, Gryllida wrote​:

This is a bug report for perl from Gryllida@​gmail.com,
generated with the help of perlbug 1.39 running under perl 5.16.2.

-----------------------------------------------------------------
Installing Perl 5.16.2 using perlbrew, t/op/groups.t fails​:

op/groups.t
(Wstat​: 0 Tests​: 1 Failed​: 0)
Parse errors​: Tests out of sequence. Found (2) but expected (1)
Bad plan. You planned 2 tests but ran 1.

Running it separately produces an output without a 'ok 1' or 'not ok
1' note for test 1​:

gry@​localhost​:~/perl5/perlbrew/build/perl-5.16.2$ ./perl t/op/groups.t
# groups =uid=1000(gry) gid=1000(gry) groups=27(sudo),1000(gry)
# gr =27(sudo),1000(gry)
# g =27(sudo),1000(gry)
# ex_gr =sudo,gry
# pwgid=1000 pwgnam=gry $(=1000 1000
# gr_name =gry,gry
1..2
ok 2
gry@​localhost​:~/perl5/perlbrew/build/perl-5.16.2$

This may be the same issue as
https://rt-archive.perl.org/perl5/Ticket/Display.html?id=71508.  Could we get a
second pair of eyes on both tickets to confirm that?

Thank you very much.
Jim Keenan

---
via perlbug​: queue​: perl5 status​: new
https://rt-archive.perl.org/perl5/Ticket/Display.html?id=116775

--
perl -Mre=debug -e "/just|another|perl|hacker/"

@p5pRT
Copy link
Author

p5pRT commented Feb 17, 2013

From @jbenjore

On Sat Feb 16 16​:51​:18 2013, demerphq wrote​:

Josh are you able to look into this? As far as I know the last patch
was from you and was quite significant.

Cheers,
Yves

Yves,
The root of the original Darwin problem was that Darwin has NGROUPS_MAX
at 15 which means that the kernel allocates only enough storage for
membership in that many groups. By default I recall, something like 12
of them are used by default.

Any LDAP groups or similar must fit within the additional 3 groups for
membership. I vaguely recall that that the $) uses an API which directly
interrogates the kernel and the allocated group membership which means
Perl conforms to the built-in limit of only 15 groups maximum. The
comments in t/op/groups.t say it's the kernel function getgroups(2).

The `id` and/or `groups` commands however are not limited by the local
machine and report all group memberships, even those that aren't
representable on the local machine. The intent of
651d468 if I recall correctly, is to
attempt to test the numeric ids returns from `id` against the numeric
ids returned by $( except when we find more ids than possible.

It is possible that on Darwin perl's $( should call the libc function
getgrouplist(3) *instead* of getgroups(2). The libc function consults
Open Directory and is not limited by the kernel's NGROUPS_MAX
allocation.

Further, it is just a rank stupid bug that this code can run and omit at
least a "not ok 1". Apologies for
http​://perl5.git.perl.org/perl.git/blob/651d4685ebdde5512841551572b29e74
605bfc38​:/t/op/groups.t#l120 which clearly allows for a missing "not ok
1".

@p5pRT
Copy link
Author

p5pRT commented Jul 13, 2013

From @jkeenan

On Sun Feb 17 15​:42​:59 2013, jbenjore wrote​:

On Sat Feb 16 16​:51​:18 2013, demerphq wrote​:

Josh are you able to look into this? As far as I know the last patch
was from you and was quite significant.

Cheers,
Yves

Yves,
The root of the original Darwin problem was that Darwin has NGROUPS_MAX
at 15 which means that the kernel allocates only enough storage for
membership in that many groups. By default I recall, something like 12
of them are used by default.

Any LDAP groups or similar must fit within the additional 3 groups for
membership. I vaguely recall that that the $) uses an API which directly
interrogates the kernel and the allocated group membership which means
Perl conforms to the built-in limit of only 15 groups maximum. The
comments in t/op/groups.t say it's the kernel function getgroups(2).

The `id` and/or `groups` commands however are not limited by the local
machine and report all group memberships, even those that aren't
representable on the local machine. The intent of
651d468 if I recall correctly, is to
attempt to test the numeric ids returns from `id` against the numeric
ids returned by $( except when we find more ids than possible.

It is possible that on Darwin perl's $( should call the libc function
getgrouplist(3) *instead* of getgroups(2). The libc function consults
Open Directory and is not limited by the kernel's NGROUPS_MAX
allocation.

Further, it is just a rank stupid bug that this code can run and omit at
least a "not ok 1". Apologies for
http​://perl5.git.perl.org/perl.git/blob/651d4685ebdde5512841551572b29e74
605bfc38​:/t/op/groups.t#l120 which clearly allows for a missing "not ok
1".

Josh, Yves​: Do we have any more insight into this problem?

Thank you very much.
Jim Keenan

@p5pRT
Copy link
Author

p5pRT commented Sep 30, 2016

From @dcollinsn

On Fri Jul 12 18​:24​:55 2013, jkeenan wrote​:

On Sun Feb 17 15​:42​:59 2013, jbenjore wrote​:

It is possible that on Darwin perl's $( should call the libc function
getgrouplist(3) *instead* of getgroups(2). The libc function consults
Open Directory and is not limited by the kernel's NGROUPS_MAX
allocation.

Further, it is just a rank stupid bug that this code can run and omit at
least a "not ok 1". Apologies for
http​://perl5.git.perl.org/perl.git/blob/651d4685ebdde5512841551572b29e74
605bfc38​:/t/op/groups.t#l120 which clearly allows for a missing "not ok
1".

The suggestion to enhance the test in the first quoted paragraph aside, the present bug is that a failing test here looks like "tests out of sequence" and "bad plan" instead of "FAILED". The attached patch will correct that issue.

--
Respectfully,
Dan Collins

@p5pRT
Copy link
Author

p5pRT commented Sep 30, 2016

From @dcollinsn

0001-RT-116775-t-op-groups.t-Add-missing-nok-1.patch
From 22b60163b28a88f5864605e8ef8c8918009b8f8c Mon Sep 17 00:00:00 2001
From: Dan Collins <dcollinsn@gmail.com>
Date: Fri, 30 Sep 2016 10:35:18 -0400
Subject: [PATCH] [RT #116775] t/op/groups.t: Add missing "nok 1"

---
 t/op/groups.t | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/op/groups.t b/t/op/groups.t
index 912b2e9..06cd3f5 100644
--- a/t/op/groups.t
+++ b/t/op/groups.t
@@ -117,7 +117,7 @@ sub Test {
         }
 
         unless ( $ok1 ) {
-
+            print "nok 1 (perl's `\$(' disagrees with `${groups_command}'\n";
         }
     }
 
-- 
2.9.3

@p5pRT
Copy link
Author

p5pRT commented Sep 30, 2016

From [Unknown Contact. See original ticket]

On Fri Jul 12 18​:24​:55 2013, jkeenan wrote​:

On Sun Feb 17 15​:42​:59 2013, jbenjore wrote​:

It is possible that on Darwin perl's $( should call the libc function
getgrouplist(3) *instead* of getgroups(2). The libc function consults
Open Directory and is not limited by the kernel's NGROUPS_MAX
allocation.

Further, it is just a rank stupid bug that this code can run and omit at
least a "not ok 1". Apologies for
http​://perl5.git.perl.org/perl.git/blob/651d4685ebdde5512841551572b29e74
605bfc38​:/t/op/groups.t#l120 which clearly allows for a missing "not ok
1".

The suggestion to enhance the test in the first quoted paragraph aside, the present bug is that a failing test here looks like "tests out of sequence" and "bad plan" instead of "FAILED". The attached patch will correct that issue.

--
Respectfully,
Dan Collins

@p5pRT
Copy link
Author

p5pRT commented Sep 30, 2016

From @jkeenan

On Fri Sep 30 07​:42​:21 2016, dcollinsn@​gmail.com wrote​:

On Fri Jul 12 18​:24​:55 2013, jkeenan wrote​:

On Sun Feb 17 15​:42​:59 2013, jbenjore wrote​:

It is possible that on Darwin perl's $( should call the libc
function
getgrouplist(3) *instead* of getgroups(2). The libc function
consults
Open Directory and is not limited by the kernel's NGROUPS_MAX
allocation.

Further, it is just a rank stupid bug that this code can run and
omit at
least a "not ok 1". Apologies for
http​://perl5.git.perl.org/perl.git/blob/651d4685ebdde5512841551572b29e74
605bfc38​:/t/op/groups.t#l120 which clearly allows for a missing
"not ok
1".

The suggestion to enhance the test in the first quoted paragraph
aside, the present bug is that a failing test here looks like "tests
out of sequence" and "bad plan" instead of "FAILED". The attached
patch will correct that issue.

#####
unless ( $ok1 ) {
-
+ print "nok 1 (perl's `\$(' disagrees with `${groups_command}'\n"; } }
#####

I generally don't like the use of the backtick character (`) to mean "single open quotation mark". But since that style is already established in the error messages in t/op/groups.t ... +1.

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Nov 18, 2016

From @jkeenan

On Fri, 30 Sep 2016 14​:42​:21 GMT, dcollinsn@​gmail.com wrote​:

On Fri Jul 12 18​:24​:55 2013, jkeenan wrote​:

On Sun Feb 17 15​:42​:59 2013, jbenjore wrote​:

It is possible that on Darwin perl's $( should call the libc
function
getgrouplist(3) *instead* of getgroups(2). The libc function
consults
Open Directory and is not limited by the kernel's NGROUPS_MAX
allocation.

Further, it is just a rank stupid bug that this code can run and
omit at
least a "not ok 1". Apologies for
http​://perl5.git.perl.org/perl.git/blob/651d4685ebdde5512841551572b29e74
605bfc38​:/t/op/groups.t#l120 which clearly allows for a missing
"not ok
1".

The suggestion to enhance the test in the first quoted paragraph
aside, the present bug is that a failing test here looks like "tests
out of sequence" and "bad plan" instead of "FAILED". The attached
patch will correct that issue.

Since no significant objection was raised to this patch, I have pushed it to blead in commit 5107ee8.

Thank you very much.
--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Nov 18, 2016

@jkeenan - Status changed from 'open' to 'resolved'

@p5pRT p5pRT closed this as completed Nov 18, 2016
@p5pRT
Copy link
Author

p5pRT commented Nov 18, 2016

From @ilmari

"James E Keenan via RT" <perlbug-followup@​perl.org> writes​:

On Fri, 30 Sep 2016 14​:42​:21 GMT, dcollinsn@​gmail.com wrote​:

The suggestion to enhance the test in the first quoted paragraph
aside, the present bug is that a failing test here looks like "tests
out of sequence" and "bad plan" instead of "FAILED". The attached
patch will correct that issue.

Since no significant objection was raised to this patch, I have pushed
it to blead in commit 5107ee8.

I missed this when it went past and only noticed when I pulled blead
just now. The patch is wrong, it should be "not ok", not "nok".

The test is already loading test.pl, but not actually using any of its
functions, so I've converted it to do so in commit 51d89e3.

--
"The surreality of the universe tends towards a maximum" -- Skud's Law
"Never formulate a law or axiom that you're not prepared to live with
the consequences of." -- Skud's Meta-Law

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant