develooper Front page | perl.perl5.porters | Postings from June 2013

[perl #118671] t/comp/parser.t loads utf8.pm from installed perl

Thread Previous
From:
Craig A . Berry
Date:
June 28, 2013 18:23
Subject:
[perl #118671] t/comp/parser.t loads utf8.pm from installed perl
Message ID:
rt-3.6.HEAD-2552-1372443777-878.118671-75-0@perl.org
# New Ticket Created by  Craig A. Berry 
# Please include the string:  [perl #118671]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=118671 >


I'm pretty sure that nothing under t/base, t/comp, or t/run should be accessing libraries via 'use' or 'require'.  The test infrastructure (TestInit.pm and t/TEST) certainly assumes this since no -I switches are put on the command line when running these tests.

comp/parser.t falls prey to this assumption by (inadvertently?) loading utf8.pm and looking for it in whatever @INC locations are hard-coded into config.h.

The reproducer is as simple as running line 479 from t/comp/parser.t as a one-liner and watching where it pulls utf8.pm from:

$ ./Configure -Dusedevel -DDEBUGGING -des && make test
<snip>
$ cd t
$ ./perl -Dt -e 'eval chr 0x387;' 2>&1 | grep utf8.pm
((eval 1):1)	const(PV("utf8.pm"\0))
(/usr/local/lib/perl5/5.19.2/utf8.pm:0)	nextstate
(/usr/local/lib/perl5/5.19.2/utf8.pm:3)	const(IV(8388608))
(/usr/local/lib/perl5/5.19.2/utf8.pm:3)	gvsv(utf8::hint_bits)
(/usr/local/lib/perl5/5.19.2/utf8.pm:3)	sassign
(/usr/local/lib/perl5/5.19.2/utf8.pm:3)	nextstate
(/usr/local/lib/perl5/5.19.2/utf8.pm:5)	const(PV("1.12"\0))
(/usr/local/lib/perl5/5.19.2/utf8.pm:5)	gvsv(utf8::VERSION)
(/usr/local/lib/perl5/5.19.2/utf8.pm:5)	sassign
(/usr/local/lib/perl5/5.19.2/utf8.pm:5)	nextstate
(/usr/local/lib/perl5/5.19.2/utf8.pm:22)	const(IV(1))
(/usr/local/lib/perl5/5.19.2/utf8.pm:22)	leaveeval
(/usr/local/lib/perl5/5.19.2/utf8.pm:16)	const(PV("utf8_heavy.pl"\0))
(/usr/local/lib/perl5/5.19.2/utf8.pm:16)	require
(/usr/local/lib/perl5/5.19.2/utf8.pm:16)	nextstate
(/usr/local/lib/perl5/5.19.2/utf8.pm:17)	gvsv(utf8::AUTOLOAD)
(/usr/local/lib/perl5/5.19.2/utf8.pm:17)	rv2cv
(/usr/local/lib/perl5/5.19.2/utf8.pm:17)	defined
(/usr/local/lib/perl5/5.19.2/utf8.pm:17)	and
(/usr/local/lib/perl5/5.19.2/utf8.pm:17)	pushmark
(/usr/local/lib/perl5/5.19.2/utf8.pm:17)	gvsv(utf8::AUTOLOAD)
(/usr/local/lib/perl5/5.19.2/utf8.pm:17)	rv2cv
(/usr/local/lib/perl5/5.19.2/utf8.pm:17)	refgen
(/usr/local/lib/perl5/5.19.2/utf8.pm:17)	goto

Bzzt.  '/usr/local/lib/perl5/5.19.2' is part of an installed perl that happens to be the same version number as the perl just built (but a few commits earlier).  The problem is much more acute if you don't have version numbers as part of the directory layout.  Such as on VMS, where the location would always be /perl_root/lib/utf8.pm regardless of what version of Perl lives there.

Not sure what the right fix is ... maybe move the test that uses utf8.pm out of parser.t into a later test that knows where its libraries are?  And/or more aggressively poisoning @INC for the core tests?

Detailed configuration follows for the sake of perlbug, but it should be reproducible anywhere.

$ ./perl -V
Summary of my perl5 (revision 5 version 19 subversion 2) configuration:
  Commit id: 38d27505c65e77f92cb8e231db1ac56a3dee8f57
  Platform:
    osname=darwin, osvers=12.4.0, archname=darwin-2level
    uname='darwin triamond.local 12.4.0 darwin kernel version 12.4.0: wed may 1 17:57:12 pdt 2013; root:xnu-2050.24.15~1release_x86_64 x86_64 '
    config_args='-Dusedevel -des'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include',
    optimize='-O3',
    cppflags='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include'
    ccversion='', gccversion='4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)', 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='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -L/usr/local/lib -L/opt/local/lib'
    libpth=/usr/local/lib /opt/local/lib /usr/lib
    libs=-ldbm -ldl -lm -lutil -lc
    perllibs=-ldl -lm -lutil -lc
    libc=, so=dylib, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib -fstack-protector'


Characteristics of this binary (from libperl):
  Compile-time options: DEBUGGING HAS_TIMES PERLIO_LAYERS
                        PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
                        PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV
                        PERL_USE_DEVEL USE_64_BIT_ALL USE_64_BIT_INT
                        USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
                        USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO
                        USE_PERL_ATOF
  Locally applied patches:
	uncommitted-changes
  Built under darwin
  Compiled at Jun 28 2013 12:05:31
  @INC:
    /usr/local/lib/perl5/site_perl/5.19.2/darwin-2level
    /usr/local/lib/perl5/site_perl/5.19.2
    /usr/local/lib/perl5/5.19.2/darwin-2level
    /usr/local/lib/perl5/5.19.2
    /usr/local/lib/perl5/site_perl
    .


________________________________________
Craig A. Berry
mailto:craigberry@mac.com

"... getting out of a sonnet is much more
 difficult than getting in."
                 Brad Leithauser


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About