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

[perl #54728] PathTools-3.27 triggers a bug in Perl

Thread Next
From:
James E Keenan via RT
Date:
August 4, 2013 00:05
Subject:
[perl #54728] PathTools-3.27 triggers a bug in Perl
Message ID:
rt-3.6.HEAD-2552-1375574729-316.54728-15-0@perl.org
On Sat May 24 07:52:30 2008, jdb wrote:
> On Sat, 24 May 2008, Rafael Garcia-Suarez wrote:
> > 
> > 2008/5/23 via RT Jan Dubois <perlbug-followup@perl.org>:
> > > The update to PathTools-3.27 triggers a bug in the localization of $1:
> > >
> > > #!perl
> > > use File::Spec::Win32 ();
> > >
> > > print File::Spec::Win32->catfile("c:/foo", "bar"), "\n";
> > > "bar" =~ m/(.*)/;
> > > print File::Spec::Win32->catfile("c:/foo", $1), "\n";
> > > "bar" =~ m/(.*)/;
> > > print File::Spec::Win32->catfile("c:/foo", "$1"), "\n";
> > > __END__
> > >
> > > With PathTools-3.27:
> > > C:\foo\bar
> > > C:\foo\c:
> > > C:\foo\bar
> > 
> > Does that happen also with older perls ?
> 
> Yes, it happens with 5.6.1 and 5.8.0 too.
>  
> All you have to do to reproduce it is copy the lib/File/Spec/Win32.pm
> into an older Perl to test this.  The problem itself is not Windows
> specific; the test program above fails the same way on Linux too.
> 
> Cheers,
> -Jan
> 


Path-Tools is a CPAN distribution.  In the Perl 5 core distribution,
File::Spec appears under 'dist/Cwd/'.  So I don't see why we should be
concerned with Path-Tools per se.

Be that as it may, I can't seem to reproduce this on Perl 5.18.0 on
Unix-ish systems (Darwin/PPC; Linux/i386):

#####
$ cat 54728_catfile.pl 
use File::Spec ();

print File::Spec->catfile("c:/foo", "bar"), "\n";
"bar" =~ m/(.*)/;
print File::Spec->catfile("c:/foo", $1), "\n";
"bar" =~ m/(.*)/;
print File::Spec->catfile("c:/foo", "$1"), "\n";
#####
$ perl 54728_catfile.pl 
c:/foo/bar
c:/foo/bar
c:/foo/bar
#####

Is this ticket closable?

Thank you very much.
Jim Keenan

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=54728

Thread Next


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