[Reproducible-commits] [dpkg] 09/37: Dpkg::Source: Make patching a file multiple times fatal for first quilt patch

Jérémy Bobbio lunar at moszumanska.debian.org
Sun Jan 31 16:28:38 UTC 2016


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch pu/buildinfo
in repository dpkg.

commit 3f11ae3b3db909f4a6fb6faba21f9688ff33a5e5
Author: Guillem Jover <guillem at debian.org>
Date:   Sat Jan 16 20:40:45 2016 +0100

    Dpkg::Source: Make patching a file multiple times fatal for first quilt patch
    
    When we check if the first quilt patch in a series can be applied, we
    use «patch --dry-run» with other options, but that cannot work if the
    same diff patches a file multiple times, as patch does not record the
    previous state in memory.
    
    We are alredy detecting this condition, but only emitting a warning,
    instead make it possible to turn it into a fatal error.
    
    Closes: #810720
    Reported-by: Apollon Oikonomopoulos <apoikos at debian.org>
---
 debian/changelog                        | 3 +++
 scripts/Dpkg/Source/Package/V3/Quilt.pm | 2 +-
 scripts/Dpkg/Source/Patch.pm            | 9 +++++++--
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 3b6fa7c..4038173 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,9 @@ dpkg (1.18.5) UNRELEASED; urgency=medium
     - Add new CTRL_REPO_RELEASE control block type to Dpkg::Control.
     - Add new CTRL_COPYRIGHT_HEADER, CTRL_COPYRIGHT_FILES and
       CTRL_COPYRIGHT_LICENSE control block types to Dpkg::Control.
+    - Make patching a file multiple times fatal for the first quilt patch in
+      Dpkg::Source. Reported by Apollon Oikonomopoulos <apoikos at debian.org>.
+      Closes: #810720
   * Documentation:
     - Say value instead of option in deb-control(5).
     - Mark debian changelog format in bold in dpkg-parsechangelog(1).
diff --git a/scripts/Dpkg/Source/Package/V3/Quilt.pm b/scripts/Dpkg/Source/Package/V3/Quilt.pm
index 497076d..7558885 100644
--- a/scripts/Dpkg/Source/Package/V3/Quilt.pm
+++ b/scripts/Dpkg/Source/Package/V3/Quilt.pm
@@ -215,7 +215,7 @@ sub check_patches_applied {
 
     my $first_patch = File::Spec->catfile($dir, 'debian', 'patches', $next);
     my $patch_obj = Dpkg::Source::Patch->new(filename => $first_patch);
-    return unless $patch_obj->check_apply($dir);
+    return unless $patch_obj->check_apply($dir, fatal_dupes => 1);
 
     $self->apply_patches($dir, usage => 'preparation', verbose => 1);
 }
diff --git a/scripts/Dpkg/Source/Patch.pm b/scripts/Dpkg/Source/Patch.pm
index dbc0fa7..36242e0 100644
--- a/scripts/Dpkg/Source/Patch.pm
+++ b/scripts/Dpkg/Source/Patch.pm
@@ -491,8 +491,13 @@ sub analyze {
 	}
 
 	if ($filepatched{$fn}) {
-	    warning(g_("diff '%s' patches file %s twice"), $diff, $fn)
-		if $opts{verbose};
+            if ($opts{fatal_dupes}) {
+                error(g_("diff '%s' patches files multiple times; split the " .
+                         "diff in multiple files or merge the hunks into a " .
+                         "single one"), $diff);
+            } elsif ($opts{verbose}) {
+                warning(g_("diff '%s' patches file %s twice"), $diff, $fn)
+            }
 	} else {
 	    $filepatched{$fn} = 1;
 	    push @patchorder, $fn;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list