Просмотр исходного кода

Dpkg::Source::Patch: Switch remaining topic to named variable in analyze()

The loop in the function was expecting $line to be filled by its last
part, and by working on the topic variable it was not getting updated.
Switch all topic variable usages in that funtion so that we can restore
working source unpacking.

Regression introduced in commmit 0d5e17af7391fb0d3a3c695dac40f8df41f8b11c.

Closes: #764206

Addresses BuiltinFunctions::ProhibitUselessTopic.

Warned-by: perlcritic
Guillem Jover лет назад: 11
Родитель
Сommit
09b0ee85ae
2 измененных файлов с 11 добавлено и 8 удалено
  1. 3 0
      debian/changelog
  2. 8 8
      scripts/Dpkg/Source/Patch.pm

+ 3 - 0
debian/changelog

@@ -1,6 +1,9 @@
 dpkg (1.17.16) UNRELEASED; urgency=low
 
   * Set the copyright holder in the po4a calls for man pages.
+  * Switch remaining topic to named variable in Dpkg::Source::Patch:analyze(),
+    otherwise the loop was expecting values in one variable but storing them
+    in another. Regression introduced in dpkg 1.17.14. Closes: #764206
 
  -- Guillem Jover <guillem@debian.org>  Mon, 06 Oct 2014 03:37:15 +0200
 

+ 8 - 8
scripts/Dpkg/Source/Patch.pm

@@ -497,14 +497,14 @@ sub analyze {
 
 	# read hunks
 	my $hunk = 0;
-	while (defined($_ = _getline($self))) {
+	while (defined($line = _getline($self))) {
 	    # read hunk header (@@)
-	    next if /^\\ /;
-	    last unless (/^@@ -\d+(,(\d+))? \+\d+(,(\d+))? @\@(?: .*)?$/);
+	    next if $line =~ /^\\ /;
+	    last unless $line =~ /^@@ -\d+(,(\d+))? \+\d+(,(\d+))? @\@(?: .*)?$/;
 	    my ($olines, $nlines) = ($1 ? $2 : 1, $3 ? $4 : 1);
 	    # read hunk
 	    while ($olines || $nlines) {
-		unless (defined($_ = _getline($self))) {
+		unless (defined($line = _getline($self))) {
                     if (($olines == $nlines) and ($olines < 3)) {
                         warning(_g("unexpected end of diff `%s'"), $diff)
                             if $opts{verbose};
@@ -513,14 +513,14 @@ sub analyze {
                         error(_g("unexpected end of diff `%s'"), $diff);
                     }
 		}
-		next if /^\\ /;
+		next if $line =~ /^\\ /;
 		# Check stats
-		if (/^ / or length == 0) {
+		if ($line =~ /^ / or length $line == 0) {
 		    --$olines;
 		    --$nlines;
-		} elsif (/^-/) {
+		} elsif ($line =~ /^-/) {
 		    --$olines;
-		} elsif (/^\+/) {
+		} elsif ($line =~ /^\+/) {
 		    --$nlines;
 		} else {
 		    error(_g("expected [ +-] at start of line %d of diff `%s'"),