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

[PATCH] Fix tests in a FreeBSD jail #15180

Closed
p5pRT opened this issue Feb 13, 2016 · 15 comments
Closed

[PATCH] Fix tests in a FreeBSD jail #15180

p5pRT opened this issue Feb 13, 2016 · 15 comments

Comments

@p5pRT
Copy link

p5pRT commented Feb 13, 2016

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

Searchable as RT127533$

@p5pRT
Copy link
Author

p5pRT commented Feb 13, 2016

From @tomhukins

Created by @tomhukins

This patch fixes a test failure in a FreeBSD jail that lacks SysV IPC
support.

Perl Info

Flags:
    category=core
    severity=low
    Type=Patch
    PatchStatus=HasPatch

Site configuration information for perl 5.20.3:

Configured by perl at Sat Sep 12 19:09:14 UTC 2015.

Summary of my perl5 (revision 5 version 20 subversion 3) configuration:
   
  Platform:
    osname=freebsd, osvers=9.3-release-p26, archname=amd64-freebsd-thread-multi
    uname='freebsd 93amd64-default-job-12 9.3-release-p26 freebsd 9.3-release-p26 amd64 '
    config_args='-sde -Dprefix=/usr/local -Dlibperl=libperl.so.5.20.3 -Darchlib=/usr/local/lib/perl5/5.20/mach -Dprivlib=/usr/local/lib/perl5/5.20 -Dman3dir=/usr/local/lib/perl5/5.20/perl/man/man3 -Dman1dir=/usr/local/lib/perl5/5.20/perl/man/man1 -Dsitearch=/usr/local/lib/perl5/site_perl/mach/5.20 -Dsitelib=/usr/local/lib/perl5/site_perl -Dscriptdir=/usr/local/bin -Dsiteman3dir=/usr/local/lib/perl5/site_perl/man/man3 -Dsiteman1dir=/usr/local/lib/perl5/site_perl/man/man1 -Ui_malloc -Ui_iconv -Uinstallusrbinperl -Dusenm=n -Dcc=cc -Duseshrplib -Dinc_version_list=none -Dcf_by=perl -Dcf_email=perl@FreeBSD.org -Dcf_time=Sat Sep 12 19:09:14 UTC 2015 -Alddlflags=-L/wrkdirs/usr/ports/lang/perl5.20/work/perl-5.20.3 -L/usr/local/lib/perl5/5.20/mach/CORE -Wl,-rpath=/usr/local/lib/perl5/5.20/mach/CORE -lperl -Dshrpldflags=$(LDDLFLAGS:N-L/wrkdirs/usr/ports/lang/perl5.20/work/perl-5.20.3:N-L/usr/local/lib/perl5/5.20/mach/CORE:N-Wl,-rpath=/usr/local/lib/perl5/5.20/mach/CORE:N-lperl) -Wl,-soname,$(LIBPERL:R) -Dotherlibdirs=/usr/local/lib/perl5/site_perl/5.20:/usr/local/lib/perl5/site_perl/5.20/mach -Doptimize=-O2 -pipe -fstack-protector -fno-strict-aliasing -Ui_gdbm -Dusemultiplicity=y -Duse64bitint -Dusethreads=y -Dusemymalloc=n'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include',
    optimize='-O2 -pipe -fstack-protector -fno-strict-aliasing',
    cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.2.1 20070831 patched [FreeBSD]', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags ='-lpthread -Wl,-E  -fstack-protector -L/usr/local/lib'
    libpth=/usr/lib /usr/local/lib /usr/include/gcc/4.2 /usr/lib
    libs=-lpthread -lm -lcrypt -lutil
    perllibs=-lpthread -lm -lcrypt -lutil
    libc=, so=so, useshrplib=true, libperl=libperl.so.5.20.3
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='  -Wl,-R/usr/local/lib/perl5/5.20/mach/CORE'
    cccdlflags='-DPIC -fPIC', lddlflags='-shared  -L/wrkdirs/usr/ports/lang/perl5.20/work/perl-5.20.3 -L/usr/local/lib/perl5/5.20/mach/CORE -Wl,-rpath=/usr/local/lib/perl5/5.20/mach/CORE -lperl -L/usr/local/lib -fstack-protector'



@INC for perl 5.20.3:
    /usr/local/lib/perl5/site_perl/mach/5.20
    /usr/local/lib/perl5/site_perl
    /usr/local/lib/perl5/5.20/mach
    /usr/local/lib/perl5/5.20
    /usr/local/lib/perl5/site_perl/5.20
    /usr/local/lib/perl5/site_perl/5.20/mach
    .


Environment for perl 5.20.3:
    HOME=/home/tom
    LANG=en_GB.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/home/tom/bin
    PERL_BADLANG (unset)
    SHELL=/usr/local/bin/zsh

@p5pRT
Copy link
Author

p5pRT commented Feb 13, 2016

From @tomhukins

0001-Handle-FreeBSD-jails-that-lack-SysV-IPC-support.patch
From 30036a2b44b78fdaf8adfc2cd5e9a045f7a10226 Mon Sep 17 00:00:00 2001
From: Tom Hukins <tom@eborcom.com>
Date: Sat, 13 Feb 2016 14:28:36 +0000
Subject: [PATCH] Handle FreeBSD jails that lack SysV IPC support

On a FreeBSD system supporting SysV IPC, jails on that system might not
support SysV IPC.  By default, jails do noth support it.  The boolean
"security.jail.sysvipc_allowed" sysctl specifies this.

This commit makes perl's test suite pass in such jailed environments.
---
 t/io/semctl.t | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/t/io/semctl.t b/t/io/semctl.t
index 53ae296..9de9309 100644
--- a/t/io/semctl.t
+++ b/t/io/semctl.t
@@ -15,7 +15,8 @@ my @warnings;
 {
     local $SIG{__WARN__} = sub { push @warnings, $_[0] };
     local $SIG{SYS} = sub { skip_all("SIGSYS caught") } if exists $SIG{SYS};
-    my $test = (semctl(-1,0,0,0))[0];
+    my $test = eval { (semctl(-1,0,0,0))[0] };
+    skip_all($@) if $@ =~ /^semctl not implemented/;
     ok(!defined $test, "erroneous semctl list slice yields undef");
 }
 
-- 
2.7.0

@p5pRT
Copy link
Author

p5pRT commented Feb 13, 2016

From @jkeenan

On Sat Feb 13 06​:46​:40 2016, tomhukins wrote​:

This is a bug report for perl from tom@​eborcom.com,
generated with the help of perlbug 1.40 running under perl 5.20.3.

-----------------------------------------------------------------
[Please describe your issue here]

This patch fixes a test failure in a FreeBSD jail that lacks SysV IPC
support.

1. Tom, can you provide the output of the actual test failure?

2. Just above the point in this test file where you provide a patch I see a SKIP for certain conditions​:

#####
12 skip_all('no SysV semaphores on this platform') if !$Config{d_sem};
13
14 my @​warnings;
15 {
16 local $SIG{__WARN__} = sub { push @​warnings, $_[0] };
17 local $SIG{SYS} = sub { skip_all("SIGSYS caught") } if exists $SIG{SYS};
18 my $test = (semctl(-1,0,0,0))[0];
19 ok(!defined $test, "erroneous semctl list slice yields undef");
20 }
#####

I'm surprised that you experienced a failure. Should we have detected a lack of semaphores during Configure?

3. Aaron Crane, the test in question is mostly your work. Can you evaluate this?

Thank you very much.

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

@p5pRT
Copy link
Author

p5pRT commented Feb 13, 2016

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

@p5pRT
Copy link
Author

p5pRT commented Feb 14, 2016

From @tomhukins

On Sat, Feb 13, 2016 at 08​:58​:12AM -0800, James E Keenan via RT wrote​:

1. Tom, can you provide the output of the actual test failure?

# ./perl -Ilib t/TEST -v io/semctl.t
t/io/semctl ... semctl not implemented at io/semctl.t line 18.
FAILED--no leader found
Failed 1 test out of 0, 0.00% okay.
  io/semctl.t
### Since not all tests were successful, you may want to run some of
### them individually and examine any diagnostic messages they produce.
### See the INSTALL document's section on "make test".
### You may have to set your dynamic library search path,
### LD_LIBRARY_PATH, to point to the build directory​:
### setenv LD_LIBRARY_PATH `pwd`; cd t; ./perl harness
### LD_LIBRARY_PATH=`pwd`; export LD_LIBRARY_PATH; cd t; ./perl harness
### export LD_LIBRARY_PATH=`pwd`; cd t; ./perl harness
### for csh-style shells, like tcsh; or for traditional/modern
### Bourne-style shells, like bash, ksh, and zsh, respectively.
Elapsed​: 0 sec
u=0.00 s=0.02 cu=0.02 cs=0.00 scripts=0 tests=0

2. Just above the point in this test file where you provide a patch I see a SKIP for certain conditions​:

Indeed. Those SKIP conditions do not match the case of building perl in
a FreeBSD jail that lacks SysV IPC when the host supports it.

Tom

@p5pRT
Copy link
Author

p5pRT commented Feb 15, 2016

From @tonycoz

On Sun Feb 14 06​:24​:41 2016, tomhukins wrote​:

On Sat, Feb 13, 2016 at 08​:58​:12AM -0800, James E Keenan via RT wrote​:

1. Tom, can you provide the output of the actual test failure?

# ./perl -Ilib t/TEST -v io/semctl.t
t/io/semctl ... semctl not implemented at io/semctl.t line 18.
FAILED--no leader found
Failed 1 test out of 0, 0.00% okay.
io/semctl.t
### Since not all tests were successful, you may want to run some of
### them individually and examine any diagnostic messages they
produce.
### See the INSTALL document's section on "make test".
### You may have to set your dynamic library search path,
### LD_LIBRARY_PATH, to point to the build directory​:
### setenv LD_LIBRARY_PATH `pwd`; cd t; ./perl harness
### LD_LIBRARY_PATH=`pwd`; export LD_LIBRARY_PATH; cd t; ./perl
harness
### export LD_LIBRARY_PATH=`pwd`; cd t; ./perl harness
### for csh-style shells, like tcsh; or for traditional/modern
### Bourne-style shells, like bash, ksh, and zsh, respectively.
Elapsed​: 0 sec
u=0.00 s=0.02 cu=0.02 cs=0.00 scripts=0 tests=0

2. Just above the point in this test file where you provide a patch I
see a SKIP for certain conditions​:

Indeed. Those SKIP conditions do not match the case of building perl
in
a FreeBSD jail that lacks SysV IPC when the host supports it.

I'm confused too, this test failure might be hiding a configuration issue.

Could you please provide the values of the d_sem values? Doing​:

  ./perl -Ilib '-V​:d_sem.*'

should do it.

For example, on Linux I see​:

tony@​mars​:.../git/perl$ ./perl -Ilib '-V​:d_sem.*'
d_sem='define';
d_semctl='define';
d_semctl_semid_ds='define';
d_semctl_semun='define';
d_semget='define';
d_semop='define';

I *suspect* the jail is messing up detection of the structure information in d_semctl_semid_ds and d_semctl_semun.

Thanks,
Tony

@p5pRT
Copy link
Author

p5pRT commented Feb 15, 2016

From @tomhukins

On Sun, Feb 14, 2016 at 04​:04​:34PM -0800, Tony Cook via RT wrote​:

I'm confused too, this test failure might be hiding a configuration issue.

Good point.

Could you please provide the values of the d_sem values? Doing​:

./perl -Ilib '-V​:d_sem.*'

# ./perl -Ilib '-V​:d_sem.*'
d_sem='define';
d_semctl='define';
d_semctl_semid_ds='undef';
d_semctl_semun='undef';
d_semget='define';
d_semop='define';

I *suspect* the jail is messing up detection of the structure
information in d_semctl_semid_ds and d_semctl_semun.

Let me know if I can provide any more information to help track down
this problem. If nobody beats me to it, I'll try to investigate some
time in the next few weeks.

Tom

@p5pRT
Copy link
Author

p5pRT commented Mar 1, 2016

From @tonycoz

On Mon Feb 15 00​:03​:22 2016, tomhukins wrote​:

Let me know if I can provide any more information to help track down
this problem. If nobody beats me to it, I'll try to investigate some
time in the next few weeks.

Please try the attached.

Tony

@p5pRT
Copy link
Author

p5pRT commented Mar 1, 2016

From @tonycoz

0001-perl-127533-only-test-semctl-if-we-have-everything-n.patch
From 9ee798dad4e9c43d3b6749b577490673680f6b17 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Tue, 1 Mar 2016 11:35:21 +1100
Subject: [perl #127533] only test semctl() if we have everything needed to use
 it

In a FreeBSD jail, the semctl() entry point might exist, but can be
disabled by policy, when it is disabled, the Configure code that
tests for the different structures that can be supplied to semctl()
fail.

The code that implements semctl() for perl treats semctl() as
unimplemented if neither structure is available, so avoid testing
semctl() if the structures couldn't be detected.
---
 t/io/semctl.t | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/t/io/semctl.t b/t/io/semctl.t
index 53ae296..2e970a7 100644
--- a/t/io/semctl.t
+++ b/t/io/semctl.t
@@ -10,6 +10,8 @@ use strict;
 use warnings;
 
 skip_all('no SysV semaphores on this platform') if !$Config{d_sem};
+skip_all('SysV semaphore structures not detected')
+    if !$Config{d_semctl_semid_ds} && !$Config{d_semctl_semun};
 
 my @warnings;
 {
-- 
2.1.4

@p5pRT
Copy link
Author

p5pRT commented Mar 7, 2016

From @tomhukins

On Mon, Feb 29, 2016 at 04​:36​:07PM -0800, Tony Cook via RT wrote​:

On Mon Feb 15 00​:03​:22 2016, tomhukins wrote​:

Let me know if I can provide any more information to help track down
this problem. If nobody beats me to it, I'll try to investigate some
time in the next few weeks.

Please try the attached.

Thanks, Tony. I confirm this patch stops the skipped tests running and
failing. Please apply it.

However, cpan/IPC-SysV/t/ipcsysv.t now fails due to changes in 38e3b2,
but that's a separate problem, so I'll file a new report against the
CPAN distribution.

Tom

@p5pRT
Copy link
Author

p5pRT commented Mar 8, 2016

From @tonycoz

On Mon Mar 07 06​:54​:19 2016, tomhukins wrote​:

On Mon, Feb 29, 2016 at 04​:36​:07PM -0800, Tony Cook via RT wrote​:

On Mon Feb 15 00​:03​:22 2016, tomhukins wrote​:

Let me know if I can provide any more information to help track down
this problem. If nobody beats me to it, I'll try to investigate some
time in the next few weeks.

Please try the attached.

Thanks, Tony. I confirm this patch stops the skipped tests running and
failing. Please apply it.

Thanks for the update, applied as 9234e5b.

However, cpan/IPC-SysV/t/ipcsysv.t now fails due to changes in 38e3b2,
but that's a separate problem, so I'll file a new report against the
CPAN distribution.

I'm seeing the same on my darwin smoke tester, but I hadn't had a chance to follow it up.

Tony

@p5pRT
Copy link
Author

p5pRT commented Mar 8, 2016

@tonycoz - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

p5pRT commented Mar 9, 2016

From @tonycoz

On Tue Mar 08 14​:34​:01 2016, tonyc wrote​:

On Mon Mar 07 06​:54​:19 2016, tomhukins wrote​:

However, cpan/IPC-SysV/t/ipcsysv.t now fails due to changes in
38e3b2,
but that's a separate problem, so I'll file a new report against the
CPAN distribution.

I'm seeing the same on my darwin smoke tester, but I hadn't had a
chance to follow it up.

Fixed in blead in cda0c02.

Reported upstream as https://rt.cpan.org/Ticket/Display.html?id=112827

Tony

@p5pRT
Copy link
Author

p5pRT commented May 13, 2016

From @khwilliamson

Thank you for submitting this report. You have helped make Perl better.
 
With the release of Perl 5.24.0 on May 9, 2016, this and 149 other issues have been resolved.

Perl 5.24.0 may be downloaded via https://metacpan.org/release/RJBS/perl-5.24.0

@p5pRT
Copy link
Author

p5pRT commented May 13, 2016

@khwilliamson - Status changed from 'pending release' to 'resolved'

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