dpkg-source: fix issue with relative filename given to --commit
authorRaphaël Hertzog <hertzog@debian.org>
Fri, 23 Dec 2011 13:52:34 +0000 (14:52 +0100)
committerRaphaël Hertzog <hertzog@debian.org>
Fri, 23 Dec 2011 13:52:34 +0000 (14:52 +0100)
With the “3.0 (quilt)” source format, dpkg-source would happily ignore the
patch-file parameter if it was not found, instead of properly erroring
out. Furthermore a relative filename would also not be found when the
given directory is "." since dpkg-source does a chdir("..") in that case.

Both issues are fixed by this commit.

Closes: #652414
Reported-by: Sam Hartman <hartmans@debian.org>

debian/changelog
scripts/Dpkg/Source/Package/V2.pm

index c4929aa..87c43ef 100644 (file)
@@ -66,6 +66,8 @@ dpkg (1.16.2) UNRELEASED; urgency=low
   * Error out if a dpkg database .list file is not a regular file. LP: #369898
   * Fix dpkg-mergechangelogs to not error out on invalid versions.
     Closes: #651993
+  * Fix dpkg-source --commit on "3.0 (quilt)" when an explicit patch file
+    is given with a relative filename. Closes: #652414
 
   [ Jonathan Nieder ]
   * Bump po4a version in Build-Depends to 0.41, since earlier versions do
index 891158d..2a7479a 100644 (file)
@@ -629,7 +629,14 @@ sub commit {
 
     $self->prepare_build($dir);
 
-    unless ($tmpdiff && -e $tmpdiff) {
+    # Try to fix up a broken relative filename for the patch
+    if ($tmpdiff and not -e $tmpdiff) {
+        $tmpdiff = File::Spec->catfile($dir, $tmpdiff)
+            unless File::Spec->file_name_is_absolute($tmpdiff);
+        error(_g("patch file '%s' doesn't exist"), $tmpdiff) if not -e $tmpdiff;
+    }
+
+    unless ($tmpdiff) {
         $tmpdiff = $self->generate_patch($dir, usage => "commit");
     }
     push @Dpkg::Exit::handlers, sub { unlink($tmpdiff) };