Skip Menu |
Report information
Id: 131296
Status: open
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: jkeenan [at] pobox.com
Cc:
AdminCc:

Operating System: Linux
PatchStatus: (no value)
Severity: medium
Type: library
Perl Version: 5.24.1
Fixed In: (no value)

Attachments
0001-Show-how-File-Spec-catfile-handles-leading.patch



To: perlbug [...] perl.org
From: James E Keenan <jkeenan [...] pobox.com>
Date: Fri, 12 May 2017 10:34:04 -0400
Subject: Combination of File::Spec->catdir() and do FILE problematic
Download (untitled) / with headers
text/plain 3.8k
This is a bug report for perl from jkeenan@zareason.(none), generated with the help of perlbug 1.40 running under perl 5.24.1. ----------------------------------------------------------------- [Please describe your issue here] See https://rt.cpan.org/Ticket/Display.html?id=121633. The patch attached brings Time-HiRes's Makefile.PL into conformance with no-dot-by-default-in-@INC. It also explicitly demonstrates how File::Spec->catfile('.', @other_args) works. [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=library severity=medium module=File::Spec --- Site configuration information for perl 5.24.1: Configured by jkeenan at Sat Jan 14 20:56:26 EST 2017. Summary of my perl5 (revision 5 version 24 subversion 1) configuration: Platform: osname=linux, osvers=4.4.0-59-generic, archname=x86_64-linux uname='linux zareason 4.4.0-59-generic #80-ubuntu smp fri jan 6 17:47:47 utc 2017 x86_64 x86_64 x86_64 gnulinux ' config_args='-de -Dprefix=/home/jkeenan/perl5/perlbrew/perls/perl-5.24.1 -Aeval:scriptdir=/home/jkeenan/perl5/perlbrew/perls/perl-5.24.1/bin' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include' ccversion='', gccversion='5.4.0 20160609', gccosandvers='' 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 =' -fstack-protector-strong -L/usr/local/lib' libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /lib64 /usr/lib64 libs=-lpthread -lnsl -ldb -ldl -lm -lcrypt -lutil -lc perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc libc=libc-2.23.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.23' 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-strong' --- @INC for perl 5.24.1: /home/jkeenan/perl5/perlbrew/perls/perl-5.24.1/lib/site_perl/5.24.1/x86_64-linux /home/jkeenan/perl5/perlbrew/perls/perl-5.24.1/lib/site_perl/5.24.1 /home/jkeenan/perl5/perlbrew/perls/perl-5.24.1/lib/5.24.1/x86_64-linux /home/jkeenan/perl5/perlbrew/perls/perl-5.24.1/lib/5.24.1 --- Environment for perl 5.24.1: HOME=/home/jkeenan LANG=en_US.UTF-8 LANGUAGE=en_US LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/home/jkeenan/perl5/perlbrew/bin:/home/jkeenan/perl5/perlbrew/perls/perl-5.24.1/bin:/usr/lib/ccache:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/jkeenan/bin:/home/jkeenan/bin/perl:/home/jkeenan/bin/shell PERLBREW_BASHRC_VERSION=0.78 PERLBREW_HOME=/home/jkeenan/.perlbrew PERLBREW_MANPATH=/home/jkeenan/perl5/perlbrew/perls/perl-5.24.1/man PERLBREW_PATH=/home/jkeenan/perl5/perlbrew/bin:/home/jkeenan/perl5/perlbrew/perls/perl-5.24.1/bin PERLBREW_PERL=perl-5.24.1 PERLBREW_ROOT=/home/jkeenan/perl5/perlbrew PERLBREW_VERSION=0.78 PERL_BADLANG (unset) PERL_WORKDIR=/home/jkeenan/gitwork/perl SHELL=/bin/bash

Message body is not shown because sender requested not to inline it.

RT-Send-CC: perl5-porters [...] perl.org
Configure and perl -V that showed this below. CFLAGS='-m64 -mtune=nocona' ./Configure -Dprefix=/opt/tools -Dotherlibdirs=/opt/tools/testing/lib -d -A ccflags=-fPIC Summary of my perl5 (revision 5 version 26 subversion 0) configuration: Platform: osname=linux osvers=3.13.0-105-generic archname=x86_64-linux uname='linux givengaindev 3.13.0-105-generic #152-ubuntu smp fri dec 2 15:37:11 utc 2016 x86_64 x86_64 x86_64 gnulinux ' config_args='-Dprefix=/opt/tools -Dotherlibdirs=/opt/tools/testing/lib -d -A ccflags=-fPIC' hint=previous useposix=true d_sigaction=define useithreads=undef usemultiplicity=undef use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n default_inc_excludes_dot=define bincompat5005=undef Compiler: cc='cc' ccflags ='-fPIC -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC' optimize='-O2' cppflags='-fPIC -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='' gccversion='4.8.4' gccosandvers='' 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 =' -fstack-protector -L/usr/local/lib' libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed /usr/include/x86_64-linux-gnu /usr/lib libs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc libc=libc-2.19.so so=so useshrplib=false libperl=libperl.a gnulibc_version='2.19' 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' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP PERL_OP_PARENT PERL_PRESERVE_IVUV USE_64_BIT_ALL USE_64_BIT_INT USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_PERLIO USE_PERL_ATOF Locally applied patches: RC1 Built under linux Compiled at May 12 2017 12:37:32 @INC: /opt/tools/lib/perl5/site_perl/5.26.0/x86_64-linux /opt/tools/lib/perl5/site_perl/5.26.0 /opt/tools/lib/perl5/5.26.0/x86_64-linux /opt/tools/lib/perl5/5.26.0 /opt/tools/lib/perl5/site_perl/5.24.0 /opt/tools/lib/perl5/site_perl/5.16.3 /opt/tools/lib/perl5/site_perl /opt/tools/testing/lib
Subject: Re: [perl #131296] Combination of File::Spec->catdir() and do FILE problematic
CC: "bugs-bitbucket [...] rt.perl.org" <bugs-bitbucket [...] rt.perl.org>
To: Perl5 Porters <perl5-porters [...] perl.org>
From: Leon Timmermans <fawaka [...] gmail.com>
Date: Sun, 14 May 2017 15:59:37 +0200
Download (untitled) / with headers
text/plain 396b
On Fri, May 12, 2017 at 4:34 PM, James E Keenan <perlbug-followup@perl.org> wrote:
Show quoted text
See https://rt.cpan.org/Ticket/Display.html?id=121633.

The patch attached brings Time-HiRes's Makefile.PL into conformance with
no-dot-by-default-in-@INC.  It also explicitly demonstrates how
File::Spec->catfile('.', @other_args) works.

I think this needs to be fixed before we put out an RC2

Leon
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.6k
On Sun, 14 May 2017 14:00:19 GMT, LeonT wrote: Show quoted text
> On Fri, May 12, 2017 at 4:34 PM, James E Keenan <perlbug-followup@perl.org> > wrote: >
> > See https://rt.cpan.org/Ticket/Display.html?id=121633. > > > > The patch attached brings Time-HiRes's Makefile.PL into conformance with > > no-dot-by-default-in-@INC. It also explicitly demonstrates how > > File::Spec->catfile('.', @other_args) works. > >
> > I think this needs to be fixed before we put out an RC2 > > Leon
If you were to ask me to look at the following line of code: ##### my $hints = File::Spec->catfile(".", "hints", "Makefile.PL"); ##### ... and then state the content of $hints -- without looking at the documentation and without consulting all the tests for this syntax in dist/PathTools/t/Spec.t -- I would probably "off the top of my head" responded: ##### ./hints/Makefile.PL ##### If that were true, then the 'do $hints;' in dist/Time-HiRes/Makefile.PL would be perfectly fine. But in reality, that line of code produces: ##### hints/Makefile.PL ##### ... in which case 'do $hints' would no longer be valid in the era of no-dot-by-default-in-@INC. File::Spec->catdir's behavior is plausible, but not necessarily what you would guess it to be. AFAICT, this is the only place in the core distribution where the arguments to File::Spec->catdir() start with '.' and where the result is used in 'do EXPR'. There may well be lots of code on CPAN or in the wild that combines File::Spec->catdir(".", @other_args) and do EXPR. Perhaps someone could do a grep of CPAN to identify such cases. But I think that if my patch is applied we will no longer have a blocker to 5.26.0. Thank you very much. -- James E Keenan (jkeenan@cpan.org)
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 2.6k
On Sun, 14 May 2017 15:09:19 GMT, jkeenan wrote: Show quoted text
> On Sun, 14 May 2017 14:00:19 GMT, LeonT wrote:
> > On Fri, May 12, 2017 at 4:34 PM, James E Keenan <perlbug- > > followup@perl.org> > > wrote: > >
> > > See https://rt.cpan.org/Ticket/Display.html?id=121633. > > > > > > The patch attached brings Time-HiRes's Makefile.PL into conformance > > > with > > > no-dot-by-default-in-@INC. It also explicitly demonstrates how > > > File::Spec->catfile('.', @other_args) works. > > >
> > > > I think this needs to be fixed before we put out an RC2 > > > > Leon
> > If you were to ask me to look at the following line of code: > > ##### > my $hints = File::Spec->catfile(".", "hints", "Makefile.PL"); > ##### > > ... and then state the content of $hints -- without looking at the > documentation and without consulting all the tests for this syntax in > dist/PathTools/t/Spec.t -- I would probably "off the top of my head" > responded: > > ##### > ./hints/Makefile.PL > ##### > > If that were true, then the 'do $hints;' in dist/Time- > HiRes/Makefile.PL would be perfectly fine. > > But in reality, that line of code produces: > > ##### > hints/Makefile.PL > ##### > > ... in which case 'do $hints' would no longer be valid in the era of > no-dot-by-default-in-@INC. File::Spec->catdir's behavior is > plausible, but not necessarily what you would guess it to be. >
commit 8b69401c2ba8d1ced2e17c24d6b51a7ce3882664 Author: James E Keenan <jkeenan@cpan.org> AuthorDate: Mon Mar 27 19:31:34 2017 -0400 Commit: David Mitchell <davem@iabyn.com> CommitDate: Fri Apr 7 14:42:24 2017 +0100 fix cases where 'do file' should be 'do ./file'. These are some cases which weren't picked up by the test suite [ This is a subset of a set of fixes originally submitted by James as 2 commits - DAPM] diff --git a/dist/Time-HiRes/Makefile.PL b/dist/Time-HiRes/Makefile.PL index ccad6a3..ca4d4dc 100644 --- a/dist/Time-HiRes/Makefile.PL +++ b/dist/Time-HiRes/Makefile.PL @@ -417,7 +417,7 @@ sub DEFINE { } sub init { - my $hints = File::Spec->catfile("hints", "$^O.pl"); + my $hints = File::Spec->catfile(".", "hints", "$^O.pl"); if (-f $hints) { [snip] ##### Dave, apply my more recent patch as needed. Show quoted text
> AFAICT, this is the only place in the core distribution where the > arguments to File::Spec->catdir() start with '.' and where the result > is used in 'do EXPR'. > > There may well be lots of code on CPAN or in the wild that combines > File::Spec->catdir(".", @other_args) and do EXPR. Perhaps someone > could do a grep of CPAN to identify such cases. But I think that if > my patch is applied we will no longer have a blocker to 5.26.0. > > Thank you very much.
-- James E Keenan (jkeenan@cpan.org)
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 2.1k
On Sun, 14 May 2017 15:09:19 GMT, jkeenan wrote: Show quoted text
> On Sun, 14 May 2017 14:00:19 GMT, LeonT wrote:
> > On Fri, May 12, 2017 at 4:34 PM, James E Keenan <perlbug- > > followup@perl.org> > > wrote: > >
> > > See https://rt.cpan.org/Ticket/Display.html?id=121633. > > > > > > The patch attached brings Time-HiRes's Makefile.PL into conformance > > > with > > > no-dot-by-default-in-@INC. It also explicitly demonstrates how > > > File::Spec->catfile('.', @other_args) works. > > >
> > > > I think this needs to be fixed before we put out an RC2 > > > > Leon
> > If you were to ask me to look at the following line of code: > > ##### > my $hints = File::Spec->catfile(".", "hints", "Makefile.PL"); > ##### > > ... and then state the content of $hints -- without looking at the > documentation and without consulting all the tests for this syntax in > dist/PathTools/t/Spec.t -- I would probably "off the top of my head" > responded: > > ##### > ./hints/Makefile.PL > ##### > > If that were true, then the 'do $hints;' in dist/Time- > HiRes/Makefile.PL would be perfectly fine. > > But in reality, that line of code produces: > > ##### > hints/Makefile.PL > ##### > > ... in which case 'do $hints' would no longer be valid in the era of > no-dot-by-default-in-@INC. File::Spec->catdir's behavior is > plausible, but not necessarily what you would guess it to be. > > AFAICT, this is the only place in the core distribution where the > arguments to File::Spec->catdir() start with '.' and where the result > is used in 'do EXPR'. > > There may well be lots of code on CPAN or in the wild that combines > File::Spec->catdir(".", @other_args) and do EXPR. Perhaps someone > could do a grep of CPAN to identify such cases. But I think that if > my patch is applied we will no longer have a blocker to 5.26.0. >
I grepped CPAN for files which contained 'catfile' and, within the next 10 lines of code, also matched '\bdo\b'. My program caught some false positives, but the only true positive I came up with was that in Time-HiRes's Makefile.PL -- the subject of this ticket. Hence, once we correct that file, we no longer have a blocker for 5.26.0. Thank you very much. -- James E Keenan (jkeenan@cpan.org)
Date: Tue, 16 May 2017 23:35:52 +0200
To: Leon Timmermans <fawaka [...] gmail.com>, Perl5 Porters <perl5-porters [...] perl.org>
From: Sawyer X <xsawyerx [...] gmail.com>
CC: "bugs-bitbucket [...] rt.perl.org" <bugs-bitbucket [...] rt.perl.org>
Subject: Re: [perl #131296] Combination of File::Spec->catdir() and do FILE problematic
Download (untitled) / with headers
text/plain 572b
On 05/14/2017 03:59 PM, Leon Timmermans wrote: Show quoted text
> On Fri, May 12, 2017 at 4:34 PM, James E Keenan > <perlbug-followup@perl.org <mailto:perlbug-followup@perl.org>> wrote: > > See https://rt.cpan.org/Ticket/Display.html?id=121633 > <https://rt.cpan.org/Ticket/Display.html?id=121633>. > > The patch attached brings Time-HiRes's Makefile.PL into > conformance with > no-dot-by-default-in-@INC. It also explicitly demonstrates how > File::Spec->catfile('.', @other_args) works. > > > I think this needs to be fixed before we put out an RC2
I agree.
Date: Mon, 22 May 2017 09:43:03 +0100
To: Sawyer X <xsawyerx [...] gmail.com>
From: Dave Mitchell <davem [...] iabyn.com>
CC: Leon Timmermans <fawaka [...] gmail.com>, Perl5 Porters <perl5-porters [...] perl.org>, "bugs-bitbucket [...] rt.perl.org" <bugs-bitbucket [...] rt.perl.org>
Subject: Re: [perl #131296] Combination of File::Spec->catdir() and do FILE problematic
Download (untitled) / with headers
text/plain 885b
On Tue, May 16, 2017 at 11:35:52PM +0200, Sawyer X wrote: Show quoted text
> > > On 05/14/2017 03:59 PM, Leon Timmermans wrote:
> > On Fri, May 12, 2017 at 4:34 PM, James E Keenan > > <perlbug-followup@perl.org <mailto:perlbug-followup@perl.org>> wrote: > > > > See https://rt.cpan.org/Ticket/Display.html?id=121633 > > <https://rt.cpan.org/Ticket/Display.html?id=121633>. > > > > The patch attached brings Time-HiRes's Makefile.PL into > > conformance with > > no-dot-by-default-in-@INC. It also explicitly demonstrates how > > File::Spec->catfile('.', @other_args) works. > > > > > > I think this needs to be fixed before we put out an RC2
> > I agree.
I've just pushed the Time::HiRes part of James's patch as v5.26.0-RC1-47-gba57084. I think the File::Spec part is best to leave for 5.27.x. -- If life gives you lemons, you'll probably develop a citric acid allergy.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org