The following commit has been merged in the master branch:
commit 7090034d26ef81114c2559f2a91b0c42b9fa82ac
Author: James Vega <[email protected]>
Date:   Sun Mar 20 15:46:42 2011 -0400

    uscan: Parse responses from FTP sites on a line-by-line basis.
    
    Closes: #597963
    Signed-off-by: James Vega <[email protected]>

diff --git a/debian/changelog b/debian/changelog
index 0637fab..be63879 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,9 @@ devscripts (2.10.72) UNRELEASED; urgency=low
     + Avoid "Use of uninitialized value" warning when URL doesn't have
       "/" after the host.  Thanks to Mats Erik Andersson for the patch.
       (Closes: #600909)
+    + Parse responses from FTP sites on a line-by-line basis to help prevent
+      overly greedy regular expressions in watch files returning bad results.
+      (Closes: #597963)
   * Remove use of lzma command in favor of xz. (Closes: #599641)
     + debian/control: Remove lzma from Recommends.
     + uscan: Use xz to repack lzma tarballs.
diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index 6b5e4fb..feb16b6 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -1025,22 +1025,24 @@ sub process_watchline ($$$$$$)
        } else {
            # they all look like:
            # info info ... info filename [ -> linkname]
-           while ($content =~ m/\s($filepattern)(\s+->\s+\S+)?$/mg) {
-               my $file = $1;
-               my $mangled_version = join(".", $file =~ m/^$filepattern$/);
-               foreach my $pat (@{$options{'uversionmangle'}}) {
-                   if (! safe_replace(\$mangled_version, $pat)) {
-                       warn "$progname: In $watchfile, potentially"
-                         . " unsafe or malformed uversionmangle"
-                         . " pattern:\n  '$pat'"
-                         . " found. Skipping watchline\n"
-                         . "  $line\n";
-                       return 1;
+           for my $ln (split(/\n/, $content)) {
+               if ($ln =~ m/\s($filepattern)(\s+->\s+\S+)?$/) {
+                   my $file = $1;
+                   my $mangled_version = join(".", $file =~ m/^$filepattern$/);
+                   foreach my $pat (@{$options{'uversionmangle'}}) {
+                       if (! safe_replace(\$mangled_version, $pat)) {
+                           warn "$progname: In $watchfile, potentially"
+                             . " unsafe or malformed uversionmangle"
+                             . " pattern:\n  '$pat'"
+                             . " found. Skipping watchline\n"
+                             . "  $line\n";
+                           return 1;
+                       }
                    }
+                   push @files, [$mangled_version, $file];
                }
-               push @files, [$mangled_version, $file];
            }
-       }           
+       }
 
        if (@files) {
            if ($verbose) {
@@ -1627,12 +1629,14 @@ sub newest_dir ($$$$$) {
        } else {
            # they all look like:
            # info info ... info filename [ -> linkname]
-           while ($content =~ m/($pattern)(\s+->\s+\S+)?$/mg) {
-               my $dir = $1;
-               my $mangled_version = join(".", $dir =~ m/^$pattern$/);
-               push @dirs, [$mangled_version, $dir];
+           foreach my $ln (split(/\n/, $content)) {
+               if ($ln =~ m/($pattern)(\s+->\s+\S+)?$/) {
+                   my $dir = $1;
+                   my $mangled_version = join(".", $dir =~ m/^$pattern$/);
+                   push @dirs, [$mangled_version, $dir];
+               }
            }
-       }           
+       }
        if (@dirs) {
            if ($debug) {
                print STDERR "-- Found the following matching dirs:\n";

-- 
Git repository for devscripts


-- 
To unsubscribe, send mail to [email protected].

Reply via email to