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
Incorrect $` after replacement #6146
Comments
From perl-5.8.0@ton.iguana.beCreated by perl-5.8.0@ton.iguana.beperl -wle '$_="abcdef\n"; s!.!!g;print "|$`|"' The last succesful match is on the f in abcdef, so why Perl Info
|
From @hvds"perl-5.8.0@ton.iguana.be (via RT)" <perlbug-followup@perl.org> wrote: It represents the failing match, but the one on the end of the Hugo |
From alex-p5p@earth.liThis bug seems to continue to be. It's not present in 5.005_03, is tortoise perl/current% diff -u t/op/pat.t.old t/op/pat.t Inline Patch--- t/op/pat.t.old Fri Jul 11 01:01:51 2003
+++ t/op/pat.t Fri Jul 11 01:02:25 2003
@@ -6,7 +6,7 @@
$| = 1;
-print "1..1006\n";
+print "1..1007\n";
BEGIN {
chdir 't' if -d 't';
@@ -3189,4 +3189,9 @@
#$_ = "x"; /x(?{func "in regexp"})/;
#$_ = "x"; /x(?{func "in multiline regexp"})/m;
-# last test 1004
+# bug 19049
+$_="abcdef\n";
+@x = m/./g;
+ok("abcde" eq "$`", '19049 - global match not setting $`');
+
+# last test 1007
|
From perl-5.8.0@ton.iguana.beCreated by perl-5.8.0@ton.iguana.beperl -wle ' outputs (as expected): 1 Notice how the second match fails and so preserves $` perl -wle ' outputs: 2 so it matched 0 times, but $` was still lost Perl Info
|
From @andk
When I see such a bug it urges me to find out the patch that introduced It was the rather small patch 2372. I hope this helps somebody to find the fix. |
From @andkThe following patch *kind* of fixes the bug 19049 and another TODO but Maybe somebody with the right regexp-fu could continue on this? I merely tried reverting parts of patch 2372 which introduced the bug, #### Patch data follows #### -- |
From @rgsAndreas J. Koenig wrote:
Thanks, applied as change #25993.
|
From @rgsRafael Garcia-Suarez wrote:
Yes. I reverted it again with change #25998. If someone wants to |
From @smpeters
This problem still exists in bleadperl@27717. |
The RT System itself - Status changed from 'new' to 'open' |
From @jbenjoreOn 4/5/06, Steve Peters via RT <perlbug-followup@perl.org> wrote:
From perlre. This is working as documented and not a bug. The numbered match variables ($1, $2, $3, etc.) and the related punctu- NOTE: failed matches in Perl do not reset the match variables, which Josh |
From Steffen_Ullrich@genua.deCreated by steffen@genua.deThe following code causes an segmentation fault on OpenBSD3.9. I guess there is some memory corruption which is detected by the my @list = ( Stacktrace: (gdb) bt Perl Info
|
From @rgsSteffen_Ullrich@genua.de (via RT) wrote:
Even though this doesn't segfault here on Linux with bleadperl, valgrind |
The RT System itself - Status changed from 'new' to 'open' |
From @ysthOn Wed, Apr 05, 2006 at 01:53:12PM -0500, Joshua ben Jore wrote:
The bug report is that a failed match (actually a failed s///g) *is* |
From @rgarciaOn 07/04/06, Rafael Garcia-Suarez <rgarciasuarez@mandriva.com> wrote:
I've added an assert() to catch such cases, but the bug should be fixed instead. Change 29271 by rgs@stencil on 2006/11/14 11:35:04 Assert that we don't access strings saved for $1 etc. out of bounds Affected files ... ... //depot/perl/mg.c#455 edit Differences ... ==== //depot/perl/mg.c#455 (text) ==== @@ -854,6 +854,7 @@ getrx: |
@rgs - Status changed from 'open' to 'resolved' |
From @demerphqHi, This bug was fixed by change 29279 (Perl 5.9.5). Thanks for the report. Cheers, |
Migrated from rt.perl.org#19049 (status was 'resolved')
Searchable as RT19049$
The text was updated successfully, but these errors were encountered: