Skip to content
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

Decoding problem with s///i in perl 5.14 #11707

Closed
p5pRT opened this issue Oct 19, 2011 · 7 comments
Closed

Decoding problem with s///i in perl 5.14 #11707

p5pRT opened this issue Oct 19, 2011 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Oct 19, 2011

Migrated from rt.perl.org#101710 (status was 'resolved')

Searchable as RT101710$

@p5pRT
Copy link
Author

p5pRT commented Oct 19, 2011

From am@jobindex.dk

Hello.

I have noticed this unexpected behaviour in perl 5.14.2​:

  perl -e 'use 5.012; my $x="br\x{f8}ndby"; $x =~ s/b/X/gi; say $x;'

outputs "Xrøndby" (in a latin1 terminal) -- that is, the last "b" is not replaced with an "X".

I have found that it works as expected in 5.12.2 as well as the blead branch. I do not know when the problem appeared, but I bisected the fix to commit 0a185c4.

The commit message seems to consider this an optimization rather than a bugfix. So I wanted to make you aware of this, and suggest inclusion on the 5.14 branch.

Thanks,
Anders.

@p5pRT
Copy link
Author

p5pRT commented Oct 20, 2011

From @nwc10

On Wed, Oct 19, 2011 at 07​:37​:32AM -0700, Anders Melchiorsen wrote​:

# New Ticket Created by Anders Melchiorsen
# Please include the string​: [perl #101710]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=101710 >

Hello.

I have noticed this unexpected behaviour in perl 5.14.2​:

perl -e 'use 5.012; my $x="br\x{f8}ndby"; $x =~ s/b/X/gi; say $x;'

outputs "Xrøndby" (in a latin1 terminal) -- that is, the last "b" is not replaced with an "X".

I have found that it works as expected in 5.12.2 as well as the blead branch. I do not know when the problem appeared, but I bisected the fix to commit 0a185c4.

I ran

../perl/Porting/bisect.pl --start v5.12.0 --end v5.14.0 -e 'use 5.012; my $x="br\x{f8}ndby"; $x =~ s/b/X/gi; say $x; exit($x =~ tr/X// == 1)'

it reports​:

HEAD is now at a33c29b foldEQ_utf8_flags​: Add no-mixing ASCII option
good - zero exit from ./perl -Ilib -e use 5.012; my $x="br\x{f8}ndby"; $x =~ s/b/X/gi; say $x; exit($x =~ tr/X// == 1)
fac1af7 is the first bad commit
commit fac1af7
Author​: Karl Williamson <public@​khwilliamson.com>
Date​: Sat Feb 12 19​:23​:34 2011 -0700

  regexec.c​: refactor find-by-class EXACTish code

  This code is way out-of-date, using upper and lower case instead of fold-case.

:100644 100644 e5e6e276f66621c881924ce7bc298011244831cf a7f55267c7dee49163360ecb00ce715ca423fbdb M regexec.c
bisect run success
That took 1219 seconds

I checked - that commit commit in v5.13.9 introduced the problem.

Neither commit adds or changes any tests. Should there be tests?

Nicholas Clark

@p5pRT
Copy link
Author

p5pRT commented Oct 20, 2011

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Oct 20, 2011

From @khwilliamson

On 10/20/2011 06​:28 AM, Nicholas Clark wrote​:

On Wed, Oct 19, 2011 at 07​:37​:32AM -0700, Anders Melchiorsen wrote​:

# New Ticket Created by Anders Melchiorsen
# Please include the string​: [perl #101710]
# in the subject line of all future correspondence about this issue.
#<URL​: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=101710>

Hello.

I have noticed this unexpected behaviour in perl 5.14.2​:

perl -e 'use 5.012; my $x="br\x{f8}ndby"; $x =~ s/b/X/gi; say $x;'

outputs "Xrøndby" (in a latin1 terminal) -- that is, the last "b" is not replaced with an "X".

I have found that it works as expected in 5.12.2 as well as the blead branch. I do not know when the problem appeared, but I bisected the fix to commit 0a185c4.

I ran

../perl/Porting/bisect.pl --start v5.12.0 --end v5.14.0 -e 'use 5.012; my $x="br\x{f8}ndby"; $x =~ s/b/X/gi; say $x; exit($x =~ tr/X// == 1)'

it reports​:

HEAD is now at a33c29b foldEQ_utf8_flags​: Add no-mixing ASCII option
good - zero exit from ./perl -Ilib -e use 5.012; my $x="br\x{f8}ndby"; $x =~ s/b/X/gi; say $x; exit($x =~ tr/X// == 1)
fac1af7 is the first bad commit
commit fac1af7
Author​: Karl Williamson<public@​khwilliamson.com>
Date​: Sat Feb 12 19​:23​:34 2011 -0700

 regexec\.c&#8203;: refactor find\-by\-class EXACTish code

 This code is way out\-of\-date\, using upper and lower case instead of fold\-case\.

:100644 100644 e5e6e276f66621c881924ce7bc298011244831cf a7f55267c7dee49163360ecb00ce715ca423fbdb M regexec.c
bisect run success
That took 1219 seconds

I checked - that commit commit in v5.13.9 introduced the problem.

Neither commit adds or changes any tests. Should there be tests?

Nicholas Clark

I did not add tests in either case because I did not think that either
commit should change any external behavior. It's scary that the test
suite had (and has) no tests for this situation. I will investigate to
understand this better; there may be other bugs still lurking here; and
certainly will add tests.

@p5pRT
Copy link
Author

p5pRT commented Nov 2, 2011

From @khwilliamson

Now resolved with commit bbdd8ba
It turns out that the root cause of this problem was not either of the
commits that have been mentioned. It's another problem that needed to
be fixed. What the commits did was to change the execution path to the
buggy code area, and then change the execution path away. But other
string/pattern combinations would trigger it, as the test case does.
--
Karl Williamson

@p5pRT
Copy link
Author

p5pRT commented Nov 2, 2011

From [Unknown Contact. See original ticket]

Now resolved with commit bbdd8ba
It turns out that the root cause of this problem was not either of the
commits that have been mentioned. It's another problem that needed to
be fixed. What the commits did was to change the execution path to the
buggy code area, and then change the execution path away. But other
string/pattern combinations would trigger it, as the test case does.
--
Karl Williamson

@p5pRT
Copy link
Author

p5pRT commented Nov 2, 2011

@khwilliamson - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant