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

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

Thread Previous | Thread Next
From:
Alexandr Ciornii
Date:
August 4, 2013 13:13
Subject:
Re: [perl #54728] PathTools-3.27 triggers a bug in Perl
Message ID:
CAB9LR-ZnewkQKw-saJty_UTD_Pn50b692kKz0gGtxu7xvPnUxQ@mail.gmail.com
This ticket can be viewed as two tickets:
1. Bug in PathTools (fixed)
2. This problem:
#!perl

"2" =~ m/(.*)/;
print test1("1", $1), "\n";

sub test1 {
  'aa' =~ m/(.)/;
  return $_[0].'/'.$_[1];
}
prints "1/a" on perl 5.18.0.

Can it be considered a bug?



2013/8/4 James E Keenan via RT <perlbug-followup@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



-- 
Alexandr Ciornii, http://chorny.net

Thread Previous | 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