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/porting/bench.t uses system perl's /lib during testing #16399

Closed
p5pRT opened this issue Feb 1, 2018 · 9 comments
Closed

t/porting/bench.t uses system perl's /lib during testing #16399

p5pRT opened this issue Feb 1, 2018 · 9 comments

Comments

@p5pRT
Copy link

@p5pRT p5pRT commented Feb 1, 2018

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

Searchable as RT132795$

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Feb 1, 2018

From @bulk88

Created by @bulk88

While upgrading blead perl, I ran into a test failure where
t/porting/bench.t (added recently in 5.27.2 in commit
6568b26 ) picked up a /lib in @​INC from
outside the build directory.

-----------------------
C​:\p527\srcnew\t>.\perl -I.. -MTestInit porting/bench.t
porting/bench.t​: Perl lib version (5.23.5) doesn't match executable
'C​:\p527\src
new\t\perl.exe' version (5.27.9) at ../lib/Config.pm line 62.
Compilation failed in require at porting/bench.t line 17.
BEGIN failed--compilation aborted at porting/bench.t line 17.

C​:\p527\srcnew\t>
-----------------------

This is the same family of bugs from now closed ticket
https://rt-archive.perl.org/perl5/Ticket/Display.html?id=116971 . ".\perl -I..
-MTestInit porting/bench.t" with the -I on cmd line is how harness
typically runs test scripts.

Top of bench.t has

-------------------
BEGIN {
  chdir '..' if -f 'test.pl' && -f 'thread_it.pl';
  require './t/test.pl';
  push @​INC, 'lib';
}
-------------------
and that chdir changed cwd up one to src tree root, then combined with
harness's -I.. made perl reach outside the source tree. I'll note all
the other files in t/porting use assignment to @​INC not a push().
changing "push @​INC, 'lib';" to "@​INC = 'lib';" made the test pass
(actually skip) for me.
----------------
C​:\p527\srcnew\t>.\perl -I.. -MTestInit porting/bench.t
1..0 # Skip not linux

C​:\p527\srcnew\t>
----------------

A system call log shows the perl proc reached outside its build dir.
------------------------
7​:06​:42.1747735 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\srcnew\t\porting\bench.t
7​:06​:42.1832055 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\srcnew\TestInit.pmc
7​:06​:42.1843928 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\srcnew\TestInit.pm
7​:06​:42.1879138 PM CreateFile 3352 perl.exe PATH NOT
FOUND C​:\p527\srcnew\t\t\TEST
7​:06​:42.1894089 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\srcnew\t\t
7​:06​:42.1915490 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\srcnew\t\test.pl
7​:06​:42.1941938 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\srcnew\t
7​:06​:42.1957033 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\srcnew\t\thread_it.pl
7​:06​:42.1972779 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\srcnew\t
7​:06​:42.1994306 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\srcnew
7​:06​:42.2010337 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\srcnew\t\test.pl
7​:06​:42.2289290 PM CreateFile 3352 perl.exe IS DIRECTORY
C​:\p527\srcnew\t
7​:06​:42.2301291 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\srcnew
7​:06​:42.2339684 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\srcnew\t\tmp3352A
7​:06​:42.2354930 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\lib\warnings.pmc
7​:06​:42.2366704 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\lib\warnings.pm
7​:06​:42.2478595 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\lib\strict.pmc
7​:06​:42.2490689 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\lib\strict.pm
7​:06​:42.2529658 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\lib\Config.pmc
7​:06​:42.2541375 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\lib\Config.pm
7​:06​:42.2567177 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\lib\vars.pmc
7​:06​:42.2578865 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\lib\vars.pm
7​:06​:42.2608210 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\lib\warnings\register.pmc
7​:06​:42.2622383 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\lib\warnings\register.pm
7​:06​:42.2686526 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\srcnew\t\tmp3352A
7​:06​:42.2700992 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\srcnew\t\tmp3352A
------------------------

Perl Info

Flags:
    category=core
    severity=low

Site configuration information for perl 5.27.9:

Configured by Administrator at Tue Jan 30 20:34:30 2018.

Summary of my perl5 (revision 5 version 27 subversion 9) configuration:
  
  Platform:
    osname=MSWin32
    osvers=5.2.3790
    archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended
    useposix=true
    d_sigaction=undef
    useithreads=define
    usemultiplicity=define
    use64bitint=undef
    use64bitall=undef
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
    bincompat5005=undef
  Compiler:
    cc='cl'
    ccflags ='-nologo -GF -W3 -O1 -MD -Zi -DNDEBUG -GL -DWIN32 
-D_CONSOLE -DNO_STRICT -D_CRT_SECURE_NO_DEPRECATE 
-D_CRT_NONSTDC_NO_DEPRECATE  -DPERL_TEXTMODE_SCRIPTS 
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DWIN32_NO_REGISTRY'
    optimize='-O1 -MD -Zi -DNDEBUG -GL'
    cppflags='-DWIN32'
    ccversion='15.00.30729.01'
    gccversion=''
    gccosandvers=''
    intsize=4
    longsize=4
    ptrsize=4
    doublesize=8
    byteorder=1234
    doublekind=3
    d_longlong=undef
    longlongsize=8
    d_longdbl=define
    longdblsize=8
    longdblkind=0
    ivtype='long'
    ivsize=4
    nvtype='double'
    nvsize=8
    Off_t='__int64'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='link'
    ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -ltcg        
-libpath:"c:\perl\lib\CORE"        -machine:x86'
    libpth="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib"
    libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib 
netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib 
odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
    perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib 
netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib 
odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
    libc=msvcrt.lib
    so=dll
    useshrplib=true
    libperl=perl527.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs
    dlext=dll
    d_dlsymun=undef
    ccdlflags=' '
    cccdlflags=' '
    lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -ltcg    
    -libpath:"c:\perl\lib\CORE"        -machine:x86'



@INC for perl 5.27.9:
    lib
    C:/p527/srcnew/lib


Environment for perl 5.27.9:
    CYGWIN=tty
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/usr/lib/x86:/usr/X11R6/lib
    LOGDIR (unset)
    PATH=C:\WINDOWS\system32;C:\Program Files (x86)\Microsoft Visual 
Studio 9.0\VC\BIN;C:\Program Files\Microsoft 
SDKs\Windows\v6.0A\bin;C:\Perl\bin;C:\WINDOWS;C:\Program Files 
(x86)\Microsoft Visual Studio 9.0\Common7\IDE;C:\Program Files 
(x86)\Git\bin;C:\sp3220\c\bin;
    PERL_BADLANG (unset)
    SHELL (unset)

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Feb 1, 2018

From @jkeenan

On Thu, 01 Feb 2018 00​:13​:16 GMT, bulk88 wrote​:

This is a bug report for perl from bulk88@​hotmail.com,
generated with the help of perlbug 1.41 running under perl 5.27.9.

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

While upgrading blead perl, I ran into a test failure where
t/porting/bench.t (added recently in 5.27.2 in commit
6568b26 ) picked up a /lib in @​INC from
outside the build directory.

-----------------------
C​:\p527\srcnew\t>.\perl -I.. -MTestInit porting/bench.t
porting/bench.t​: Perl lib version (5.23.5) doesn't match executable
'C​:\p527\src
new\t\perl.exe' version (5.27.9) at ../lib/Config.pm line 62.
Compilation failed in require at porting/bench.t line 17.
BEGIN failed--compilation aborted at porting/bench.t line 17.

C​:\p527\srcnew\t>
-----------------------

This is the same family of bugs from now closed ticket
https://rt-archive.perl.org/perl5/Ticket/Display.html?id=116971 . ".\perl -I..
-MTestInit porting/bench.t" with the -I on cmd line is how harness
typically runs test scripts.

Top of bench.t has

-------------------
BEGIN {
chdir '..' if -f 'test.pl' && -f 'thread_it.pl';
require './t/test.pl';
push @​INC, 'lib';
}
-------------------
and that chdir changed cwd up one to src tree root, then combined with
harness's -I.. made perl reach outside the source tree. I'll note all
the other files in t/porting use assignment to @​INC not a push().
changing "push @​INC, 'lib';" to "@​INC = 'lib';" made the test pass
(actually skip) for me.
----------------
C​:\p527\srcnew\t>.\perl -I.. -MTestInit porting/bench.t
1..0 # Skip not linux

C​:\p527\srcnew\t>
----------------

A system call log shows the perl proc reached outside its build dir.
------------------------
7​:06​:42.1747735 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\srcnew\t\porting\bench.t
7​:06​:42.1832055 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\srcnew\TestInit.pmc
7​:06​:42.1843928 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\srcnew\TestInit.pm
7​:06​:42.1879138 PM CreateFile 3352 perl.exe PATH NOT
FOUND C​:\p527\srcnew\t\t\TEST
7​:06​:42.1894089 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\srcnew\t\t
7​:06​:42.1915490 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\srcnew\t\test.pl
7​:06​:42.1941938 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\srcnew\t
7​:06​:42.1957033 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\srcnew\t\thread_it.pl
7​:06​:42.1972779 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\srcnew\t
7​:06​:42.1994306 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\srcnew
7​:06​:42.2010337 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\srcnew\t\test.pl
7​:06​:42.2289290 PM CreateFile 3352 perl.exe IS DIRECTORY
C​:\p527\srcnew\t
7​:06​:42.2301291 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\srcnew
7​:06​:42.2339684 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\srcnew\t\tmp3352A
7​:06​:42.2354930 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\lib\warnings.pmc
7​:06​:42.2366704 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\lib\warnings.pm
7​:06​:42.2478595 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\lib\strict.pmc
7​:06​:42.2490689 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\lib\strict.pm
7​:06​:42.2529658 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\lib\Config.pmc
7​:06​:42.2541375 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\lib\Config.pm
7​:06​:42.2567177 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\lib\vars.pmc
7​:06​:42.2578865 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\lib\vars.pm
7​:06​:42.2608210 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\lib\warnings\register.pmc
7​:06​:42.2622383 PM CreateFile 3352 perl.exe SUCCESS
C​:\p527\lib\warnings\register.pm
7​:06​:42.2686526 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\srcnew\t\tmp3352A
7​:06​:42.2700992 PM CreateFile 3352 perl.exe NAME NOT
FOUND C​:\p527\srcnew\t\tmp3352A
------------------------

Please review the patch attached.

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

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Feb 1, 2018

From @jkeenan

0001-Ensure-that-we-don-t-pick-up-any-system-perl-librari.patch
From 7176369a25e8f19ca42037b34cf29d3ca1c1b533 Mon Sep 17 00:00:00 2001
From: James E Keenan <jkeenan@cpan.org>
Date: Wed, 31 Jan 2018 21:59:21 -0500
Subject: [PATCH] Ensure that we don't pick up any "system perl" libraries in
 @INC.

We need a tightly defined @INC which, for this test file, only needs './lib'
so that we can locate the two pragmata and Config.

For: RT # 132795
---
 t/porting/bench.t | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/t/porting/bench.t b/t/porting/bench.t
index ee4c1c3..7c137c1 100644
--- a/t/porting/bench.t
+++ b/t/porting/bench.t
@@ -7,9 +7,9 @@
 # See also t/porting/bench_selftest.pl
 
 BEGIN {
-    chdir '..' if -f 'test.pl' && -f 'thread_it.pl';
+    chdir '..' if -f 'test.pl';
+    @INC = ( './lib' );
     require './t/test.pl';
-    push @INC, 'lib';
 }
 
 use warnings;
@@ -22,7 +22,7 @@ use Config;
 # Only test on a platform likely to support forking, pipes, cachegrind
 # etc.  Add other platforms if you think they're safe.
 
-skip_all "not devel"   unless -d ".git";
+skip_all "not devel"   unless -d "./.git";
 skip_all "not linux"   unless $^O eq 'linux';
 skip_all "no valgrind" unless -x '/bin/valgrind' || -x '/usr/bin/valgrind';
 # Address sanitizer clashes horribly with cachegrind
-- 
2.7.4

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Feb 1, 2018

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

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Feb 1, 2018

From @bulk88

On Wed, 31 Jan 2018 19​:04​:02 -0800, jkeenan wrote​:

Please review the patch attached.

Thank you very much.

Patch works for me. I have no comment on the other changes in that patch other than @​INC assignment vs push.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Feb 23, 2018

From @jkeenan

On Thu, 01 Feb 2018 05​:14​:35 GMT, bulk88 wrote​:

On Wed, 31 Jan 2018 19​:04​:02 -0800, jkeenan wrote​:

Please review the patch attached.

Thank you very much.

Patch works for me. I have no comment on the other changes in that
patch other than @​INC assignment vs push.

Patch pushed to blead in commit 361b6e5.

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

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Feb 23, 2018

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

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jun 23, 2018

From @khwilliamson

Thank you for filing this report. You have helped make Perl better.

With the release yesterday of Perl 5.28.0, this and 185 other issues have been
resolved.

Perl 5.28.0 may be downloaded via​:
https://metacpan.org/release/XSAWYERX/perl-5.28.0

If you find that the problem persists, feel free to reopen this ticket.

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jun 23, 2018

@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