tag 544931 patch
thanks
I've tried many cases and they all passed.
Cheers,
--
Raphael Geissert - Debian Developer
www.debian.org - get.debian.net
diff --git a/scripts/uscan.pl b/home/raphael/Deb/devscripts-2.10.54/scripts/uscan.pl
index 11fbc54..64fc9e5 100755
--- a/scripts/uscan.pl
+++ b/home/raphael/Deb/devscripts-2.10.54/scripts/uscan.pl
@@ -1846,7 +1846,6 @@ sub safe_replace($$) {
if ($sep eq '{' or $sep eq '(' or $sep eq '[' or $sep eq '<') {
($parsed_ok, $regexp, $replacement, $flags) = quoted_regex_parse($pat);
-
return 0 unless $parsed_ok;
} elsif ($pat !~ /^(?:s|tr|y)$esc((?:\\.|[^\\$esc])*)$esc((?:\\.|[^\\$esc])*)$esc([a-z]*)$/) {
return 0;
@@ -1899,16 +1898,18 @@ sub safe_replace($$) {
# a copy. We'll need to restore it to the current value if
# the global flag was set on the input pattern.
my $orig_replacement = $replacement;
+ my $prev = qr'.*?';
while (1) {
eval {
# handle errors due to unsafe constructs in $regexp
no re 'eval';
- my $re = qr/$flags$regexp/;
+ my $re = qr/^$prev\K$flags$regexp/;
@captures = ($$in =~ $re);
($first, $last) = ($-[0], $+[0]);
+ $prev = substr($$in, 0, $-[0]);
};
return 0 if $@;
@@ -1931,6 +1932,9 @@ sub safe_replace($$) {
# Actually do the replacement
substr $$in, $first, $last - $first, $replacement;
+ $prev .= substr $$in, $first, length($replacement);
+ $prev = qr,\Q$prev\E.*?,;
+
if ($global) {
$replacement = $orig_replacement;
} else {