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

Regression with (?{})(?=...) and pos #14016

Closed
p5pRT opened this issue Aug 2, 2014 · 15 comments

Comments

@p5pRT
Copy link
Collaborator

@p5pRT p5pRT commented Aug 2, 2014

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

Searchable as RT122460$

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 2, 2014

From @cpansprout

The presence of the code block in the second program should make no
difference. The first result (0) is correct.

$ perl5.21.3 -le '$_ =3D "rdvark"; /(?=3D[A-Za-z0-9_])a*?/g; warn pos'
0 at -e line 1.
$ perl5.21.3 -le '$_ =3D "rdvark"; /(?{})(?=3D[A-Za-z0-9_])a*?/g; warn pos'
3 at -e line 1.

That 3 should be 0, too.

A bisect points to this​:

commit 77ebeeb
Author​: Karl Williamson <public@​khwilliamson.com>
Date​: Mon Sep 30 14​:06​:23 2013 -0600

  PATCH​: [perl #120041] regcomp.c missing parens and broken STCLASS

(Sorry, I should have noticed this before the release of 5.20.)

Most importantly, I need a workaround. :-)

--

Father Chrysostomos

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 3, 2014

From @khwilliamson

On 08/02/2014 12​:01 PM, Father Chrysostomos (via RT) wrote​:

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

The presence of the code block in the second program should make no
difference. The first result (0) is correct.

$ perl5.21.3 -le '$_ =3D "rdvark"; /(?=3D[A-Za-z0-9_])a*?/g; warn pos'
0 at -e line 1.
$ perl5.21.3 -le '$_ =3D "rdvark"; /(?{})(?=3D[A-Za-z0-9_])a*?/g; warn pos'
3 at -e line 1.

That 3 should be 0, too.

A bisect points to this​:

commit 77ebeeb
Author​: Karl Williamson <public@​khwilliamson.com>
Date​: Mon Sep 30 14​:06​:23 2013 -0600

 PATCH&#8203;: \[perl \#120041\] regcomp\.c missing parens and broken STCLASS

(Sorry, I should have noticed this before the release of 5.20.)

Most importantly, I need a workaround. :-)

Not having looked into this at all, but knowing that 5.20.1 is due this
month, if this were to get into that release, would that be a good
enough workaround?

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 3, 2014

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

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 8, 2014

From @khwilliamson

Now fixed by 842a9d2
which I vote to backport into 5.20.1
--
Karl Williamson

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 8, 2014

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

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 8, 2014

From @khwilliamson

Reopening so I can instead mark it as pending release
--
Karl Williamson

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 8, 2014

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

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 8, 2014

@khwilliamson - Status changed from 'open' to 'pending release'

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 9, 2014

From @cpansprout

On Fri Aug 08 11​:52​:10 2014, khw wrote​:

Now fixed by 842a9d2
which I vote to backport into 5.20.1

Thank you. It gets my vote, too.

On Sat Aug 02 20​:07​:50 2014, public@​khwilliamson.com wrote​:

Not having looked into this at all, but knowing that 5.20.1 is due
this
month, if this were to get into that release, would that be a good
enough workaround?

Yes, that would be okay. However, I would still like to get my module working with 5.20.0 if possible, so I have some questions​:

$ perl5.21.3 -Mre=debug -e 'my $a = "rdvark"; $a =~ /(?=[A-Za-z0-9_])a*?/g;'
...
stclass ANYOF[0-9A-Z_a-z] minlen 0
...
$ perl5.21.3 -Mre=debug -e 'my $a = "rdvark"; $a =~ /(?{})(?=[A-Za-z0-9_])a*?/g;'
...
stclass ANYOF[a] minlen 0 with eval
...

(These one-liners are from before the fix.)

It seems that the stclass optimisation is behaving differently depending on the presence or absence of an eval. (I find that surprising. I thought the optimisation would just be turned on or off.)

What can I add to the pattern to turn off the optimisation altogether? Under what circumstances does this bug occur? (I.e., where does (?=) have to be in the pattern, etc.) Is it only with (?=...) or does it apply to other assertions, too?

--

Father Chrysostomos

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 9, 2014

From [Unknown Contact. See original ticket]

On Fri Aug 08 11​:52​:10 2014, khw wrote​:

Now fixed by 842a9d2
which I vote to backport into 5.20.1

Thank you. It gets my vote, too.

On Sat Aug 02 20​:07​:50 2014, public@​khwilliamson.com wrote​:

Not having looked into this at all, but knowing that 5.20.1 is due
this
month, if this were to get into that release, would that be a good
enough workaround?

Yes, that would be okay. However, I would still like to get my module working with 5.20.0 if possible, so I have some questions​:

$ perl5.21.3 -Mre=debug -e 'my $a = "rdvark"; $a =~ /(?=[A-Za-z0-9_])a*?/g;'
...
stclass ANYOF[0-9A-Z_a-z] minlen 0
...
$ perl5.21.3 -Mre=debug -e 'my $a = "rdvark"; $a =~ /(?{})(?=[A-Za-z0-9_])a*?/g;'
...
stclass ANYOF[a] minlen 0 with eval
...

(These one-liners are from before the fix.)

It seems that the stclass optimisation is behaving differently depending on the presence or absence of an eval. (I find that surprising. I thought the optimisation would just be turned on or off.)

What can I add to the pattern to turn off the optimisation altogether? Under what circumstances does this bug occur? (I.e., where does (?=) have to be in the pattern, etc.) Is it only with (?=...) or does it apply to other assertions, too?

--

Father Chrysostomos

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 9, 2014

From @cpansprout

On Sat Aug 09 09​:49​:38 2014, sprout wrote​:

What can I add to the pattern to turn off the optimisation altogether?
Under what circumstances does this bug occur? (I.e., where does (?=)
have to be in the pattern, etc.) Is it only with (?=...) or does it
apply to other assertions, too?

My meagre experimentation suggests that it only occurs with (?=...) and that adding (??{}) to the pattern will disable the bug. So I will use that for now....

--

Father Chrysostomos

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 9, 2014

From [Unknown Contact. See original ticket]

On Sat Aug 09 09​:49​:38 2014, sprout wrote​:

What can I add to the pattern to turn off the optimisation altogether?
Under what circumstances does this bug occur? (I.e., where does (?=)
have to be in the pattern, etc.) Is it only with (?=...) or does it
apply to other assertions, too?

My meagre experimentation suggests that it only occurs with (?=...) and that adding (??{}) to the pattern will disable the bug. So I will use that for now....

--

Father Chrysostomos

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 11, 2014

From @steve-m-hay

On 9 August 2014 17​:49, Father Chrysostomos via RT
<perlbug-comment@​perl.org> wrote​:

On Fri Aug 08 11​:52​:10 2014, khw wrote​:

Now fixed by 842a9d2
which I vote to backport into 5.20.1

Thank you. It gets my vote, too.

+1 from me too, and now cherry-picked into maint-5.20.

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 2, 2015

From @khwilliamson

Thanks for submitting this ticket

The issue should be resolved with the release today of Perl v5.22. If you find that the problem persists, feel free to reopen this ticket

--
Karl Williamson for the Perl 5 porters team

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 2, 2015

@khwilliamson - Status changed from 'pending release' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.