Closed p5pRT closed 20 years ago
The following code hangs when run under perl 5.6.1. It runs just fine under 5.005_03\, and possibly other versions.
my @strings = (''\, '..'); my @sorted = sort { study $a; return 1 if (($a =~ m/\w\.$/) && ($b !~ m/\.$/)); return 0; } @strings;
This works fine if the study is removed. It also works fine outside the context of a sort.
The following code hangs when run under perl 5.6.1. It runs just fine under 5.005_03\, and possibly other versions.
my @strings = (''\, '..'); my @sorted = sort { study $a; return 1 if (($a =~ m/\w\.$/) && ($b !~ m/\.$/)); return 0; } @strings;
This works fine if the study is removed. It also works fine outside the context of a sort.
--- study.t 2001/11/02 04:16:23 1.1 +++ study.t 2001/11/02 04:22:17 @@ -47\,7 +47\,7 @@ }
-print "1..26\n"; +print "1..27\n";
$x = "abc\ndef\n"; study($x); @@ -117\,5 +117\,9 @@ study; alarm_ok { /G.F$/ }; alarm_ok { /[F]F$/ }; + + $_ = '..'; + study; + alarm_ok { /[a]\.$/ }; # perlbug 20011101.074 }
--
Michael G. Schwern \schwern@​pobox\.com http://www.pobox.com/~schwern/ Perl6 Quality Assurance \perl\-qa@​perl\.org Kwalitee Is Job One OH GOD!! It's LINUX! All you Linux fanboys go wild! It never crashes! It'll wash your underpants! It'll eat your dog for you\, if you want your dog to be eaten! It'll make you attractive and smell good and... it'll... uh... uh. Man\, I'm so sick of this shit. http://www.goats.com/archive/000602.html
The following code hangs when run under perl 5.6.1. It runs just fine under 5.005_03\, and possibly other versions.
my @strings = (''\, '..'); my @sorted = sort { study $a; return 1 if (($a =~ m/\w\.$/) && ($b !~ m/\.$/)); return 0; } @strings;
This works fine if the study is removed. It also works fine outside the context of a sort.
The following code hangs when run under perl 5.6.1. It runs just fine under 5.005_03\, and possibly other versions.
my @strings = (''\, '..'); my @sorted = sort { study $a; return 1 if (($a =~ m/\w\.$/) && ($b !~ m/\.$/)); return 0; } @strings;
This works fine if the study is removed. It also works fine outside the context of a sort.
Thanks for the report. This bug has already been fixed in the latest development version\, so 5.6.2 and 5.8.0 should both work correctly once they become available.
Unfortunately I do not know of an easy workaround for this bug\, except not to use study when your regexps are end-anchored (ie\, have a '$' anchor). However\, in the example code you show I would be surprised if the study() was gaining you anything - you may want to try doing some benchmarks against perl5.005_03 to verify.
If you desperately need a fix for 5.6.1\, the patch at: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2001-06/msg01000.html should apply at around line 1306 of util.c.
Hope this helps\,
Hugo van der Sanden
Migrated from rt.perl.org#7866 (status was 'resolved')
Searchable as RT7866$