Package: dpkg
Version: 1.20.0+nmu2~1.gbpcd9614
Severity: normal
Tags: patch

Dear Maintainer,

while building some of my packages, I noticed they were built without
patches applied. Further investigation in the code showed that it was
caused by dpkg-source --before-build carrying on silently if the first
patch could't be applied, eg. when the series was partially applied, or
the patch itself was somehow defective. It seems this behaviour was a
legacy from package format 2 and IMHO is totally unneeded with quilt. I
therefore suggest to apply this patch, which I've used for several
months now without problems. It relegates the issue of deciding when to
apply patches to quilt.

Regards
    Jiri Palecek

From f489217e511c4ed5c78d63fcc7688a630b73bc67 Mon Sep 17 00:00:00 2001
From: =?iso8859-2?q?Ji=F8=ED=20Pale=E8ek?= <jpale...@web.de>
Date: Sun, 27 Oct 2019 18:55:06 +0100
Subject: [PATCH] Don't pass before-build stage when first patch doesn't apply
 with format V3-quilt

 When the first patch doesn't apply, dpkg-source --before-build
 silently continues. This behaviour is meant to allow it to continue
 when the patch series has been applied, however, it also makes it
 very prone to breakage. Particularly, if your first patch is applied
 but the rest isn't (eg. has been applied upstream), or if it is
 defective, you are going to get a package built with Debian patches
 silently ignored. Quilt will safely apply all the patches, even if
 some of them are already applied, and fail correctly when the patches
 are defective. V2 doesn't offer any such functionality, so IMHO the
 cleanest behaviour is to rely on quilt and fail if patches according
 to its bookkeeping should be applied but can't.

---
 scripts/Dpkg/Source/Package/V3/Quilt.pm | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/scripts/Dpkg/Source/Package/V3/Quilt.pm b/scripts/Dpkg/Source/Package/V3/Quilt.pm
index 45237d26a..25c5aab1b 100644
--- a/scripts/Dpkg/Source/Package/V3/Quilt.pm
+++ b/scripts/Dpkg/Source/Package/V3/Quilt.pm
@@ -235,10 +235,6 @@ sub check_patches_applied {
     my $next = $quilt->next();
     return if not defined $next;

-    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, fatal_dupes => 1);
-
     $self->apply_patches($dir, usage => 'preparation', verbose => 1);
 }

--
2.25.1

-- Package-specific info:

-- System Information:
Debian Release: 10.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 
'testing-debug'), (500, 'unstable'), (1, 'experimental-debug'), (1, 
'experimental')
Architecture: i386 (i686)
Foreign Architectures: amd64

Kernel: Linux 5.5.0-rc5-686-pae (SMP w/2 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=cs_CZ, LC_CTYPE=cs_CZ (charmap=ISO-8859-2), LANGUAGE=cs_CZ 
(charmap=ISO-8859-2)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages dpkg depends on:
ii  libbz2-1.0   1.0.8-2
ii  libc6        2.30-4
ii  liblzma5     5.2.4-1+b1
ii  libselinux1  3.0-1+b1
ii  tar          1.30+dfsg-6
ii  zlib1g       1:1.2.11.dfsg-2

dpkg recommends no packages.

Versions of packages dpkg suggests:
ii  apt            2.0.1
pn  debsig-verify  <none>

-- no debconf information

Reply via email to