Front page | perl.perl5.porters |
Postings from April 2008
[perl #52658] Perl 5.10 regression bug in match and substitution evaluation in list context
Thread Next
From:
Wolf-Dietrich Moeller
Date:
April 9, 2008 09:38
Subject:
[perl #52658] Perl 5.10 regression bug in match and substitution evaluation in list context
Message ID:
rt-3.6.HEAD-25460-1207746182-1717.52658-75-0@perl.org
# New Ticket Created by Wolf-Dietrich Moeller
# Please include the string: [perl #52658]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=52658 >
Hi,
The following bug showed up on transition from perl 5.8 to perl 5.10.
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'.
This is shown by the test program below.
Test program:
# test program to show bug in Perl 5.10
# no bug in Perl 5.6 and 5.8
use strict;
my (@te,$reg);
############ substitution without 'evaluate'
$reg ='../xxx/';
@te = ($reg=~m~^(/?(?:\.\./)*)~,$reg=~s/(x)/b/g >1?'##':'++');
print "without bug: (0)=$te[0] (1)=$te[1] reg=$reg\n";
#################### substitution with 'evaluate'
$reg ='../xxx/';
@te = ($reg=~m~^(/?(?:\.\./)*)~,$reg=~s/(x)/'b'/eg >1?'##':'++');
print "with bug: (0)=$te[0] (1)=$te[1] reg=$reg\n";
The result in 5.8 is (i.e. the bug is not there):
D:\Daten\Temp>test4.pl
without bug: (0)=../ (1)=## reg=../bbb/
with bug: (0)=../ (1)=## reg=../bbb/
While 5.10 results in (i.e. with bug):
D:\Daten\Temp>test4.pl
without bug: (0)=../ (1)=## reg=../bbb/
with bug: (0)=3 (1)=## reg=../bbb/
Thanks
Wolf
PS.
Sorry I did not use the recommended tools for version reporting, as nowadays I only have access to Windows environment with ActiveState Perl windows binary. But:
!!! I reported the bug to ActiveState last summer, and they did not handle it (still not even reviewed)!!!
As I assume the bug is not a problem of the Windows port, but of the basic perl as provided by perl.org, I decided to report it also here.
The bug version history to my knowledge:
- The bug was not existent in Perl 5.6 (on Unix) a few years ago (yes, the program exists that long).
- The bug did not exist in ActiveState until 5.8.8 Build 820. (Actually the bug crept in with the last Build 5.8.8.822, but ActiveState wrote, that they included there some new modules, maybe from 5.10 also).
- The bug exists in ActiveState 5.10.0.1001 and stays in 5.10.0.1002.
----------------------------------------
Dr. Wolf-Dietrich Moeller
COO RTP PT SWT SW Asset Prot & ProdSec SDE
D-81541 München, Mch M, Tel. +49 89 636-53391, Fax -75166
mailto:wolf-dietrich.moeller@nsn.com
Nokia Siemens Networks GmbH & Co. KG
Sitz der Gesellschaft: München / Registered office: Munich
Registergericht: München / Commercial registry: Munich, HRA 88537
WEEE-Reg.-Nr.: DE 52984304
Persönlich haftende Gesellschafterin / General Partner: Nokia Siemens Networks Management GmbH
Geschäftsleitung / Board of Directors: Lydia Sommer, Olaf Horsthemke
Vorsitzender des Aufsichtsrats / Chairman of supervisory board: Lauri Kivinen
Sitz der Gesellschaft: München / Registered office: Munich
Registergericht: München / Commercial registry: Munich, HRB 163416
Thread Next
-
[perl #52658] Perl 5.10 regression bug in match and substitution evaluation in list context
by Wolf-Dietrich Moeller