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

Win32: Use of // after a successful /(?{})/ results in strange effect #17070

Open
p5pRT opened this issue Jul 1, 2019 · 8 comments
Open

Win32: Use of // after a successful /(?{})/ results in strange effect #17070

p5pRT opened this issue Jul 1, 2019 · 8 comments

Comments

@p5pRT
Copy link

p5pRT commented Jul 1, 2019

Migrated from rt.perl.org#134246 (status was 'open')

Searchable as RT134246$

@p5pRT
Copy link
Author

p5pRT commented Jul 1, 2019

From @haukex

Hi,

As first reported by PerlMonks user Eily at
http​://www.perlmonks.org/?node_id=11102239 :

The output of the attached script under Linux, Perls 5.20.0 through
5.30.0, is as expected​:
--8<--
Regex!
Item​: Bar
Item​: Foo
Regex!
-->8--

However, under Strawberry Perl 5.30.0.1-64bit on Win 7, the output is​:
--8<--
Regex!

Item​: Bar

Item​: Foo

Use of uninitialized value in say at strangebug.pl line 4.

Foo

-->8--

This seems to be some really strange memory (stack? dunno) issue that I
can't further diagnose myself. I also haven't been able to make the
example code much shorter yet.

Regards,
-- Hauke D

@p5pRT
Copy link
Author

p5pRT commented Jul 1, 2019

From @haukex

strangebug.pl

@p5pRT
Copy link
Author

p5pRT commented Jul 1, 2019

From @haukex

On Mon, 01 Jul 2019 10​:25​:48 -0700, haukex@​zero-g.net wrote​:

However, under Strawberry Perl 5.30.0.1-64bit on Win 7, the output is​:
--8<--
Regex!

Item​: Bar

...

Sorry, the output under Windows doesn't really have those extra blank lines, seems my mail client didn't like me pasting CRLF into the mail (looked fine before sending).

Regards,
-- Hauke D

@p5pRT
Copy link
Author

p5pRT commented Jul 1, 2019

From [Unknown Contact. See original ticket]

On Mon, 01 Jul 2019 10​:25​:48 -0700, haukex@​zero-g.net wrote​:

However, under Strawberry Perl 5.30.0.1-64bit on Win 7, the output is​:
--8<--
Regex!

Item​: Bar

...

Sorry, the output under Windows doesn't really have those extra blank lines, seems my mail client didn't like me pasting CRLF into the mail (looked fine before sending).

Regards,
-- Hauke D

@p5pRT
Copy link
Author

p5pRT commented Jul 2, 2019

From @sisyphus

On my Windows 7 box I have stable perl versions 5.x.0 for x in the range
10..30.
The strange behaviour begins with perl-5.18.0 and persists all the way
through to 5.30.0.
The strange behaviour is not dependent upon architecture (at least not the
32bit/64bit, ivtype, ntype variants that I have), nor can it be attributed
to a change compiler behaviour as my perl-5.18.0 was built with the same
gcc-4.7.0 that built the earlier versions.

Hope that helps narrow it down a bit.

Cheers,
Rob

On Tue, Jul 2, 2019 at 3​:28 AM Hauke D via RT <perlbug-comment@​perl.org>
wrote​:

On Mon, 01 Jul 2019 10​:25​:48 -0700, haukex@​zero-g.net wrote​:

However, under Strawberry Perl 5.30.0.1-64bit on Win 7, the output is​:
--8<--
Regex!

Item​: Bar

...

Sorry, the output under Windows doesn't really have those extra blank
lines, seems my mail client didn't like me pasting CRLF into the mail
(looked fine before sending).

Regards,
-- Hauke D

@p5pRT
Copy link
Author

p5pRT commented Jul 2, 2019

From @sisyphus

Sorry - I failed to mention that I (obviously) removed the "use 5.020;"
from the demo script and replaced "say" with "print" & "\n".

Cheers,
Rob

On Tue, Jul 2, 2019 at 12​:23 PM sisyphus <sisyphus359@​gmail.com> wrote​:

On my Windows 7 box I have stable perl versions 5.x.0 for x in the range
10..30.
The strange behaviour begins with perl-5.18.0 and persists all the way
through to 5.30.0.
The strange behaviour is not dependent upon architecture (at least not the
32bit/64bit, ivtype, ntype variants that I have), nor can it be attributed
to a change compiler behaviour as my perl-5.18.0 was built with the same
gcc-4.7.0 that built the earlier versions.

Hope that helps narrow it down a bit.

Cheers,
Rob

On Tue, Jul 2, 2019 at 3​:28 AM Hauke D via RT <perlbug-comment@​perl.org>
wrote​:

On Mon, 01 Jul 2019 10​:25​:48 -0700, haukex@​zero-g.net wrote​:

However, under Strawberry Perl 5.30.0.1-64bit on Win 7, the output is​:
--8<--
Regex!

Item​: Bar

...

Sorry, the output under Windows doesn't really have those extra blank
lines, seems my mail client didn't like me pasting CRLF into the mail
(looked fine before sending).

Regards,
-- Hauke D

@p5pRT
Copy link
Author

p5pRT commented Jul 2, 2019

From @hvds

I haven't investigated what's going on here, but something similar happens with this simpler testcase​:

% perl -wle '(my $x = "x") =~ /.(?{ print "Regex!" })/; func(); sub func { "Foo" =~ //i }'
Regex!

%

Running with -Mre=debug shows that we really are attempting to re-invoke the regexp, but the EVAL node is somehow printing an empty string - at least with my (Ubuntu) system perl, a threaded non-debugging perl-5.26.1 (+ 67 Ubuntu patches). Reinvoking at the top level (without wrapping in the function call) prints "Regex!" twice as expected.

I can't reproduce the problem with an unthreaded debugging 5.30.0.

I haven't got time to dig further right now, but it feels like clarifying relevant build options would be a useful first step.

Hugo

@p5pRT
Copy link
Author

p5pRT commented Jul 2, 2019

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

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

No branches or pull requests

3 participants