Browse Source

Fix perl warnings:
- When unpacking a source package with -sp from a different directory
than the one containing the tarball. Closes: #424998

Guillem Jover 17 years ago
parent
commit
256eda4fcf
3 changed files with 21 additions and 6 deletions
  1. 7 0
      ChangeLog
  2. 3 0
      debian/changelog
  3. 11 6
      scripts/dpkg-source.pl

+ 7 - 0
ChangeLog

@@ -1,3 +1,10 @@
+2007-05-23  Guillem Jover  <guillem@debian.org>
+
+	* scripts/dpkg-source.pl ($copy_required): New variable.
+	($dumptardev, $dumptarino): Move declaration inside the block issues
+	the stat call, and only compare them against $dsctardev and $dsctarino
+	if the stat succeeded.
+
 2007-05-21  Guillem Jover  <guillem@debian.org>
 
 	* scripts/dpkg-statoverride.pl ($pat): Rename to ...

+ 3 - 0
debian/changelog

@@ -1,6 +1,9 @@
 dpkg (1.14.4) UNRELEASED; urgency=low
 
   [ Guillem Jover ]
+  * Fix perl warnings:
+    - When unpacking a source package with -sp from a different directory
+      than the one containing the tarball. Closes: #424998
   * Remove an unused variable in dpkg-statoverride by renaming it to the
     initially intended name. Closes: #425041
 

+ 11 - 6
scripts/dpkg-source.pl

@@ -835,15 +835,20 @@ if ($opmode eq 'build') {
 		    &syserr(sprintf(_g("failed to stat `%s' to see if need to copy"), "$dscdir/$tarfile"));
 
 		my ($dsctardev, $dsctarino) = stat _;
-		my ($dumptardev, $dumptarino);
+		my $copy_required;
 
-		if (!stat($tarfile)) {
-		    $! == ENOENT || &syserr(sprintf(_g("failed to check destination `%s'".
-					    " to see if need to copy"), $tarfile));
+		if (stat($tarfile)) {
+		    my ($dumptardev, $dumptarino) = stat _;
+		    $copy_required = ($dumptardev != $dsctardev ||
+		                      $dumptarino != $dsctarino);
 		} else {
-		    ($dumptardev,$dumptarino) = stat _;
+		    $! == ENOENT ||
+			syserr(sprintf(_g("failed to check destination `%s'".
+			       " to see if need to copy"), $tarfile));
+		    $copy_required = 1;
 		}
-		unless ($dumptardev == $dsctardev && $dumptarino == $dsctarino) {
+
+		if ($copy_required) {
 		    system('cp','--',"$dscdir/$tarfile", $tarfile);
 		    $? && subprocerr("cp $dscdir/$tarfile to $tarfile");
 		}