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
Perl 5.10 regression bug in match and substitution evaluation in list context #9284
Comments
From wolf-dietrich.moeller@nsn.comHi, On evaluation of a list of a match and a substitution the assigned results depend on the fact if within the the second list element the substitution has the 'e' = evaluate flag or not. The list assigned to @te should contain as first element the catch from the match. This is done correctly in older perl versions, and when the substitution in the 2nd element does not contain the evaluate flag. In perl 5.10 together with the evaluate flag on the substitution, the list does no longer contain the catch of the match (first element), but the number of substutions in the substitution (second element), which should only be used as condition for the comparison '> 1'. Test program: The result in 5.8 is (i.e. the bug is not there): While 5.10 results in (i.e. with bug): Thanks PS. The bug version history to my knowledge: Dr. Wolf-Dietrich Moeller Nokia Siemens Networks GmbH & Co. KG Persönlich haftende Gesellschafterin / General Partner: Nokia Siemens Networks Management GmbH |
From @nwc10On Wed, Apr 09, 2008 at 06:03:03AM -0700, Wolf-Dietrich Moeller wrote:
Thanks for the test case. I can confirm that the different behaviour is still Unfortunately, I've also found that it's in 5.8.9-to-be, so it's currently Andreas, are you able to work out what change to blead introduced this? Nicholas Clark |
The RT System itself - Status changed from 'new' to 'open' |
From @andk
> Andreas, are you able to work out what change to blead introduced this? Delicious testcase. It finds not one but rather two changes. First ----Output of .../pDfmfu6/perl-5.9.2@26332/bin/perl---- ----EOF ($?='0')---- ----EOF ($?='0')---- Change 26334 by rgs@stencil on 2005/12/12 16:03:00 A suggestion by Yamashina Hio to speed up substitutions Affected files ... ... //depot/perl/pp_ctl.c#496 edit And the second was this one: ----Output of .../pNJPWnJ/perl-5.9.3@28253/bin/perl---- ----EOF ($?='0')---- ----EOF ($?='0')---- Change 28254 by davem@davem-splatty on 2006/05/20 14:30:50 eval { s/$foo/die/e } leaked a scalar Affected files ... ... //depot/perl/pp_ctl.c#568 edit Enjoy, |
From @rgsOn 10/04/2008, Andreas J. Koenig
I've now reverted this optimisation and added a regression test based |
@rgs - Status changed from 'open' to 'resolved' |
From andris@hpl.hp.comIt appears that there's a bug in Perl v5.10.0 that is only The problem is that a regex operation fails when trying to Here is the output of the demonstration script which is Regards, HP-UX usno# perl-bug The "%Names" hash is *not* tied to the "Tie-CPHash" module. Incrementing the numeric value of `$Names{'ntp-1.2.3.4'}'... Contatenating '2' to the value of `$Names{'ntp-1.2.3.4'}'... Using regex to remove `ntp2-pa' from the value of `$Names{'ntp-1.2.3.4'}'... ....................................................................... usno# perl-bug show Executing `tie %Names, "Tie::CPHash";'. Incrementing the numeric value of `$Names{'ntp-1.2.3.4'}'... Contatenating '2' to the value of `$Names{'ntp-1.2.3.4'}'... *DEFECT* ....................................................................... usno# perl -V Characteristics of this binary (from libperl): NOTE: Despite using the instrumentation features of HP's ANSI-C I will recompile using Perl's malloc to see aany useful Linux (Debian) masterns# ./perl-bug The "%Names" hash is *not* tied to the "Tie-CPHash" module. Incrementing the numeric value of `$Names{'ntp-1.2.3.4'}'... Contatenating '2' to the value of `$Names{'ntp-1.2.3.4'}'... Using regex to remove `ntp2-pa' from the value of `$Names{'ntp-1.2.3.4'}'... ....................................................................... masterns# ./perl-bug show Executing `tie %Names, "Tie::CPHash";'. Incrementing the value of `$Names{'ntp-1.2.3.4'}' Contatenating '2' to the value of `$Names{'ntp-1.2.3.4'}' *DEFECT* ....................................................................... masterns# perl -V Characteristics of this binary (from libperl): *********************************************************************** #!/usr/bin/perl -w use strict; my ($name, %Names); if (@ARGV) { # Initialize the "%Names" hash with a numeric value. # Modify the value of the hash to demonstrate that $Names{'ntp-1.2.3.4'}++; print " After: \$Names\{'ntp-1.2.3.4'\} = ", # Initialize the "%Names" hash with a simple character value. # Modify the value of the hash to demonstrate that a simple $Names{'ntp-1.2.3.4'} .= '2'; print " After: \$Names\{'ntp-1.2.3.4'\} = '", # Initialize the "%Names" hash with the demonstration data. # Modify the value of the hash with an RE to expose the perl defect. $Names{'ntp-1.2.3.4'} =~ s/(^|\s)$name\s/$1/; print " After: \$Names\{'ntp-1.2.3.4'\} = '", exit; |
From perl@cjmweb.netHere's a simpler test case that uses only core modules. It works fine #! /usr/bin/perl my %h; $h{key} = 'ntp-2 ntp2 ntp-pa ntp-2-pa ntp2-pa '; die "not ok: <$h{key}>\n" print "ok\n"; -- |
The RT System itself - Status changed from 'new' to 'open' |
perl@cjmweb.net - Status changed from 'open' to 'new' |
From perl@cjmweb.netHas anybody had a chance to look at this regression in 5.10.0? The original example was fairly complicated, but I boiled it down to a It uses only core modules. If it does anything except print "ok" then -- |
From @mhxThis was caused by change #26334, and has been fixed by reverting Marcus |
The RT System itself - Status changed from 'new' to 'open' |
Migrated from rt.perl.org#52658 (status was 'resolved')
Searchable as RT52658$
The text was updated successfully, but these errors were encountered: