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

t/op/dump.t fails on OpenBSD #14664

Closed
p5pRT opened this issue Apr 21, 2015 · 5 comments
Closed

t/op/dump.t fails on OpenBSD #14664

p5pRT opened this issue Apr 21, 2015 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Apr 21, 2015

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

Searchable as RT124357$

@p5pRT
Copy link
Author

p5pRT commented Apr 21, 2015

From @tonycoz

Created by @tonycoz

t/op/dump.t fails on OpenBSD apparently unable to map ./perl to an
absolute path​:

$ make test TEST_FILES=op/dump.t
...
cd t && (rm -f perl; /bin/ln -s ../perl perl)
./runtests choose
t/op/dump ... which_perl​: cannot find ./perl from ./perl at ./test.pl line 837.
# Failed test 1 - plain dump quits at ./test.pl line 1039
# got 'sh​: ./perl​: not found'
# expected /(?^​:\AA(?!B\z))/
# PROG​:
# ++$|;
# my $pid = fork;
# die "fork​: $!\n" unless defined $pid;
# if ($pid) {
# # parent
# waitpid($pid, 0);
# }
# else {
# # child
# print qq(A);
# dump;
# print qq(B);
# }
# STATUS​: 32512
# Failed test 2 - dump with label quits at ./test.pl line 1039
# got 'sh​: ./perl​: not found'
# expected /(?^​:A(?!B\z))/
# PROG​:
# ++$|;
# my $pid = fork;
# die "fork​: $!\n" unless defined $pid;
# if ($pid) {
# # parent
# waitpid($pid, 0);
# }
# else {
# print qq(A);
# dump foo;
# foo​:
# print qq(B);
# }
# STATUS​: 32512
FAILED at test 1
Failed 1 test out of 1, 0.00% okay.
  op/dump.t
### Since not all tests were successful, you may want to run some of
...

Note that perl has no mechanism on OpenBSD (such as /proc/self/exe) to
map $^X to an absolute path, which may be why this isn't happening on
smokers, which I believe all of which do.

Originally reported by stsc via IRC in #p5p.

Perl Info

Flags:
    category=core
    severity=medium

Site configuration information for perl 5.21.11:

Configured by tony at Tue Apr 21 09:24:23 EST 2015.

Summary of my perl5 (revision 5 version 21 subversion 11) configuration:
  Commit id: 79ce1a76a68648f6b503f9be5f59f10e15c2996d
  Platform:
    osname=openbsd, osvers=4.7, archname=OpenBSD.amd64-openbsd-thread-multi
    uname='openbsd openbsd64.tony.develop-help.com 4.7 generic.mp#130 amd64 '
    config_args='-des -Dusedevel -Dusethreads'
    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 ='-pthread -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include',
    optimize='-O2',
    cppflags='-pthread -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='3.3.5 (propolice)', gccosandvers='openbsd4.7'
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags ='-pthread -Wl,-E  -fstack-protector -L/usr/local/lib'
    libpth=/usr/lib /usr/local/lib
    libs=-lpthread -lm -lutil -lc
    perllibs=-lpthread -lm -lutil -lc
    libc=/usr/lib/libc.so.53.1, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-DPIC -fPIC ', lddlflags='-shared -fPIC  -L/usr/local/lib -fstack-protector'



@INC for perl 5.21.11:
    lib
    /usr/local/lib/perl5/site_perl/5.21.11/OpenBSD.amd64-openbsd-thread-multi
    /usr/local/lib/perl5/site_perl/5.21.11
    /usr/local/lib/perl5/5.21.11/OpenBSD.amd64-openbsd-thread-multi
    /usr/local/lib/perl5/5.21.11
    .


Environment for perl 5.21.11:
    HOME=/home/tony
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/tony/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games:.
    PERL_BADLANG (unset)
    SHELL=/bin/ksh

@p5pRT
Copy link
Author

p5pRT commented Apr 21, 2015

From @tonycoz

On Mon Apr 20 19​:18​:55 2015, tonyc wrote​:

t/op/dump.t fails on OpenBSD apparently unable to map ./perl to an
absolute path​:

The attached appears to fix it for me.

Tony

@p5pRT
Copy link
Author

p5pRT commented Apr 21, 2015

From @tonycoz

0001-perl-124357-make-sure-which_perl-can-find-.-perl-on-.patch
From ef7bd33cee5527164ebf5fe517b02b5b3aa0403b Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Tue, 21 Apr 2015 13:50:58 +1000
Subject: [PATCH] [perl #124357] make sure which_perl() can find ./perl on in
 op/dump.t

OpenBSD doesn't set $^X to an absolute path. and since op/dump.t
chdir()s to a temp directory, which_perl() produced "./perl" which
is useless in the new directory.

Instead manually set $^X to an absolute path so which_perl() can find
it after the chdir.  This should be safe on the platforms we allow
op/dump.t to run on.
---
 t/op/dump.t |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/t/op/dump.t b/t/op/dump.t
index 1db1637..7c5c3af 100644
--- a/t/op/dump.t
+++ b/t/op/dump.t
@@ -13,6 +13,7 @@ BEGIN {
 use Config;
 use File::Temp qw(tempdir);
 use Cwd qw(getcwd);
+use File::Spec;
 
 skip_all("only tested on devel builds")
   unless $Config{usedevel};
@@ -33,6 +34,11 @@ my $tmp = tempdir(CLEANUP => 1);
 
 my $start = getcwd;
 
+# on systems which don't make $^X absolute which_perl() in test.pl won't
+# return an absolute path, so once we change directories it can't
+# find ./perl, resulting in test failures
+$^X = File::Spec->rel2abs($^X);
+
 chdir $tmp
   or skip_all("Cannot chdir to work directory");
 
-- 
1.7.10.4

@p5pRT
Copy link
Author

p5pRT commented Apr 23, 2015

From @tonycoz

On Mon Apr 20 20​:52​:29 2015, tonyc wrote​:

On Mon Apr 20 19​:18​:55 2015, tonyc wrote​:

t/op/dump.t fails on OpenBSD apparently unable to map ./perl to an
absolute path​:

The attached appears to fix it for me.

Applied as e9c7535.

Tony

@p5pRT p5pRT closed this as completed Apr 23, 2015
@p5pRT
Copy link
Author

p5pRT commented Apr 23, 2015

@tonycoz - Status changed from 'new' 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