develooper Front page | perl.perl5.changes | Postings from November 2002

Change 18179: [PATCH] UTF8 regexp {n} bug

From:
hv
Date:
November 24, 2002 20:30
Subject:
Change 18179: [PATCH] UTF8 regexp {n} bug
Message ID:
200211250430.gAP4U7O09193@smtp3.ActiveState.com
Change 18179 by hv@hv-crypt.org on 2002/11/25 03:06:44

	Subject: [PATCH] UTF8 regexp {n} bug
	From: Inaba Hiroto <inaba@st.rim.or.jp>
	Date: Sat, 16 Nov 2002 19:23:00 +0900
	Message-ID: <3DD61C83.62FF9887@st.rim.or.jp>

Affected files ...

.... //depot/perl/regcomp.c#313 edit
.... //depot/perl/t/op/pat.t#183 edit

Differences ...

==== //depot/perl/regcomp.c#313 (text) ====
Index: perl/regcomp.c
--- perl/regcomp.c#312~18119~	Thu Nov  7 04:13:28 2002
+++ perl/regcomp.c	Sun Nov 24 19:06:44 2002
@@ -1270,6 +1270,8 @@
 			l -= old;
 			/* Get the added string: */
 			last_str = newSVpvn(s  + old, l);
+			if (UTF)
+			    SvUTF8_on(last_str);
 			if (deltanext == 0 && pos_before == b) {
 			    /* What was added is a constant string */
 			    if (mincount > 1) {

==== //depot/perl/t/op/pat.t#183 (xtext) ====
Index: perl/t/op/pat.t
--- perl/t/op/pat.t#182~17994~	Thu Oct 10 13:19:27 2002
+++ perl/t/op/pat.t	Sun Nov 24 19:06:44 2002
@@ -6,7 +6,7 @@
 
 $| = 1;
 
-print "1..941\n";
+print "1..942\n";
 
 BEGIN {
     chdir 't' if -d 't';
@@ -2995,4 +2995,14 @@
 print "\x{0712}" =~ /\p{Syriac1}/ ? "ok $test\n" : "not ok $test\n"; $test++;
 print "\x{072F}" =~ /\P{Syriac1}/ ? "ok $test\n" : "not ok $test\n"; $test++;
 
-# last test 940
+{
+    # Change #18179: previously failed with "panic: end_shift"
+    my $s = "\x{100}" x 5;
+    my $ok = $s =~ /(\x{100}{4})/;
+    my($ord, $len) = (ord $1, length $1);
+    print +($ok && $ord == 0x100 && $len == 4)
+	    ? "ok $test\n" : "not ok $test\t# $ok/$ord/$len\n";
+    ++$test;
+}
+
+# last test 942
End of Patch.




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About