Debian Bug report logs - #683547
dpkg-source fails on a patch series deleting a file after patching

version graph

Package: dpkg-dev; Maintainer for dpkg-dev is Dpkg Developers <debian-dpkg@lists.debian.org>; Source for dpkg-dev is src:dpkg.

Reported by: Thomas Koch <thomas@koch.ro>

Date: Wed, 1 Aug 2012 16:09:01 UTC

Severity: normal

Tags: patch

Found in version dpkg/1.16.8

Fixed in version dpkg/1.16.9

Done: Guillem Jover <guillem@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, thomas@koch.ro, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#683547; Package dpkg-dev. (Wed, 01 Aug 2012 16:09:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Thomas Koch <thomas@koch.ro>:
New Bug report received and forwarded. Copy sent to thomas@koch.ro, Dpkg Developers <debian-dpkg@lists.debian.org>. (Wed, 01 Aug 2012 16:09:04 GMT) Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Thomas Koch <thomas@koch.ro>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: dpkg-source fails on a patch series deleting a file after patching
Date: Wed, 01 Aug 2012 18:04:16 +0200
[Message part 1 (text/plain, inline)]
Package: dpkg-dev
Version: 1.16.8
Severity: normal

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi,

I try to build the GWT source package which has somewhat dirty patch series:
First a file is patched and then a later patch deletes it. The parent dir of
this file is empty.

It might not be a good idea in the first place to have such a patch series. But
dpkg-source --after-build fails on it. It can not copy the original file because
the parent directory of the original file does not exist anymore.

I suspect, that the patch command deleted all empty parent directories as
described for the -remove-empty-files option. I tried to provide a fix that
calls make_path($target_dir) in scripts/Dpkg/Source/Quilt.pm but I failed perl.

I'll attach the tar.gz of a minimal source tree to reproduce the bug. Just call
dpkg-source --before-build . && dpkg-source --after-build .

Regards, Thomas Koch

- -- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages dpkg-dev depends on:
ii  base-files    6.9
ii  binutils      2.22-6.1
ii  bzip2         1.0.6-3
ii  libdpkg-perl  1.16.8
ii  make          3.81-8.2
ii  patch         2.6.1-3
ii  xz-utils      5.1.1alpha+20120614-1

Versions of packages dpkg-dev recommends:
ii  build-essential          11.5
ii  fakeroot                 1.18.4-2
ii  gcc [c-compiler]         4:4.7.1-1
ii  gcc-4.4 [c-compiler]     4.4.7-1
ii  gcc-4.5 [c-compiler]     4.5.3-12
ii  gcc-4.6 [c-compiler]     4.6.3-8
ii  gcc-4.7 [c-compiler]     4.7.1-2
ii  gnupg                    1.4.12-4+b1
ii  gpgv                     1.4.12-4+b1
ii  libalgorithm-merge-perl  0.08-2

Versions of packages dpkg-dev suggests:
ii  debian-keyring  2012.06.01

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBCAAGBQJQGVN6AAoJEAf8SJEEK6ZaWHkP/0jQ/ZVu2e/dNyNj4PATe1Yj
eJjzVz+PEoKvU8gmDqN1efy7tP0tpKs2HlHGHin3AbtKF9G1YBuLSVXPB47e4G6w
H/jqRq2BmumDT2aRWjGl4whSCxjzFVC1Xgy8qGhh6uVWtxTUhLwsmjjcEFQJfvEA
djCShu8q+o930rA0j7hWthih/9rZ+St2yMXk82rb++vD8N7vooZ/aY+Ic8uL+jpE
B5c5NCTkKNNTNg1G2RKQut4OgWcnEO3ilOjwSR6jsNdIs7s4i/loq7j76IoqWgdj
TwO6v6NCDl9VWMu5jtj+gtYaqBjywaDs3vTtjE6Tv/9TavHZnn7zXtFdlchlccy/
9t/AF7iZJoSapTUFhWEWFyWBeJbq3PU+Lasjq7bL+QB12y1DybjWz7Rpys6ZX6H9
4x5Jz6IaF9UiNDtL9D4PgX0vMSFOx+7RQNvSuwf3xuyLDGPGPkfyYVvPwT3aJ2xp
s0NnzOyd43/0DMMZOhxhs/FK6YJw7rzp/bMcq0EmNgrAkPr7x4Xg/DO0EO2S1lL8
tS3xjrlytk4JLFi/OD/9VWfN4/dOTNy7FjGR0m+F7xCsCckfyk7tAoTqrGhGw0JA
OaoUjHhalQ73uhig8UEIZ+s3CdS1fjAzhZotw4qaVFxuU02aM21633rCbLznWynf
F/fPdZqZd89CeGaEIHy0
=wkC0
-----END PGP SIGNATURE-----
[dpkg-bug.tar.gz (application/x-gzip, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#683547; Package dpkg-dev. (Wed, 01 Aug 2012 19:45:13 GMT) Full text and rfc822 format available.

Acknowledgement sent to Raphael Hertzog <hertzog@debian.org>:
Extra info received and forwarded to list. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. (Wed, 01 Aug 2012 19:45:13 GMT) Full text and rfc822 format available.

Message #10 received at 683547@bugs.debian.org (full text, mbox):

From: Raphael Hertzog <hertzog@debian.org>
To: Thomas Koch <thomas@koch.ro>, 683547@bugs.debian.org
Subject: Re: Bug#683547: dpkg-source fails on a patch series deleting a file after patching
Date: Wed, 1 Aug 2012 21:33:40 +0200
[Message part 1 (text/plain, inline)]
Control: tag 683547 + patch

On Wed, 01 Aug 2012, Thomas Koch wrote:
> It might not be a good idea in the first place to have such a patch series. But
> dpkg-source --after-build fails on it. It can not copy the original file because
> the parent directory of the original file does not exist anymore.
> 
> I suspect, that the patch command deleted all empty parent directories as
> described for the -remove-empty-files option. I tried to provide a fix that
> calls make_path($target_dir) in scripts/Dpkg/Source/Quilt.pm but I failed perl.

You diagnosed the problem correctly. This is effectively a regression
because we had no such problem when we used "patch -R" to unapply the
patches. Now that we use the quilt backup files instead, we're affected by
this issue.

I attach my suggested patch. Please try it.

I will certainly push this to master for inclusion in wheezy since
it's a regression introduced by my changes in dpkg 1.16.5.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Get the Debian Administrator's Handbook:
→ http://debian-handbook.info/get/
[0001-Dpkg-Source-Quilt-ensure-the-target-directory-exist-.patch (text/x-diff, attachment)]

Added tag(s) patch. Request was from Raphael Hertzog <hertzog@debian.org> to 683547-submit@bugs.debian.org. (Wed, 01 Aug 2012 19:45:13 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#683547; Package dpkg-dev. (Wed, 01 Aug 2012 21:39:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to thomas@koch.ro:
Extra info received and forwarded to list. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. (Wed, 01 Aug 2012 21:39:03 GMT) Full text and rfc822 format available.

Message #17 received at 683547@bugs.debian.org (full text, mbox):

From: Thomas Koch <thomas@koch.ro>
To: Raphael Hertzog <hertzog@debian.org>
Cc: 683547@bugs.debian.org
Subject: Re: Bug#683547: dpkg-source fails on a patch series deleting a file after patching
Date: Wed, 1 Aug 2012 23:06:42 +0200
Raphael Hertzog:
> You diagnosed the problem correctly. This is effectively a regression
> because we had no such problem when we used "patch -R" to unapply the
> patches. Now that we use the quilt backup files instead, we're affected by
> this issue.
> 
> I attach my suggested patch. Please try it.
works. thx!

Thomas Koch, http://www.koch.ro



Added tag(s) pending. Request was from Raphaël Hertzog <hertzog@debian.org> to control@bugs.debian.org. (Fri, 03 Aug 2012 08:21:08 GMT) Full text and rfc822 format available.

Message sent on to Thomas Koch <thomas@koch.ro>:
Bug#683547. (Fri, 03 Aug 2012 08:21:10 GMT) Full text and rfc822 format available.

Message #22 received at 683547-submitter@bugs.debian.org (full text, mbox):

From: Raphaël Hertzog <hertzog@debian.org>
To: 683547-submitter@bugs.debian.org
Subject: Bug#683547 marked as pending
Date: Fri, 03 Aug 2012 08:20:07 +0000
tag 683547 pending
thanks

Hello,

Bug #683547 reported by you has been fixed in the Git repository. You can
see the changelog below, and you can check the diff of the fix at:

    http://git.debian.org/?p=dpkg/dpkg.git;a=commitdiff;h=7dc49d5

---
commit 7dc49d57932d023a637c6085d53e4ede0059b23a
Author: Raphaël Hertzog <hertzog@debian.org>
Date:   Wed Aug 1 21:18:07 2012 +0200

    Dpkg::Source::Quilt: ensure the target directory exist before copying files
    
    When we restore files in the pop operation, the target directory is
    usually pre-existing, but in the case where the patch is removing all the
    files in the directory, the usage of patch's --remove-empty-files lead to
    the removal of the parent directories which are empty.
    
    This caused a regression in dpkg-source's handling of "3.0 (quilt)" source
    package since we switched "3.0 (quilt)" to restore the quilt backup files
    to unapply patches. Formerly we were using "patch -R" which was creating
    the required directories by itself.
    
    Reported-by: Thomas Koch <thomas@koch.ro>
    Closes: #683547

diff --git a/debian/changelog b/debian/changelog
index ee103a5..074a3d6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,9 @@
 dpkg (1.16.9) UNRELEASED; urgency=low
 
+  [ Raphaël Hertzog ]
+  * Fix dpkg-source regression in "3.0 (quilt)" source packages while
+    unapplying patches that remove all files in a directory. Closes: #683547
+
   [ Updated programs translations ]
   * Czech (Miroslav Kure).
   * Portuguese (Miguel Figueiredo). Closes: #682582



Added indication that bug 683547 blocks 684453 Request was from Thomas Koch <thomas@koch.ro> to 684453-submit@bugs.debian.org. (Tue, 16 Oct 2012 14:15:04 GMT) Full text and rfc822 format available.

Reply sent to Guillem Jover <guillem@debian.org>:
You have taken responsibility. (Sat, 20 Oct 2012 05:36:20 GMT) Full text and rfc822 format available.

Notification sent to Thomas Koch <thomas@koch.ro>:
Bug acknowledged by developer. (Sat, 20 Oct 2012 05:36:20 GMT) Full text and rfc822 format available.

Message #29 received at 683547-close@bugs.debian.org (full text, mbox):

From: Guillem Jover <guillem@debian.org>
To: 683547-close@bugs.debian.org
Subject: Bug#683547: fixed in dpkg 1.16.9
Date: Sat, 20 Oct 2012 05:32:34 +0000
Source: dpkg
Source-Version: 1.16.9

We believe that the bug you reported is fixed in the latest version of
dpkg, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 683547@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Guillem Jover <guillem@debian.org> (supplier of updated dpkg package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Sat, 20 Oct 2012 05:59:50 +0200
Source: dpkg
Binary: libdpkg-dev dpkg dpkg-dev libdpkg-perl dselect
Architecture: source amd64 all
Version: 1.16.9
Distribution: unstable
Urgency: low
Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
Changed-By: Guillem Jover <guillem@debian.org>
Description: 
 dpkg       - Debian package management system
 dpkg-dev   - Debian package development tools
 dselect    - Debian package management front-end
 libdpkg-dev - Debian package management static library
 libdpkg-perl - Dpkg perl modules
Closes: 682582 682978 683104 683221 683411 683514 683547 684776 685103 685297 685677 685863 686421 686995 687002 687656 688050 688416 689820 689836 689863 690415 690426 690431 690449 690678 690808 690823
Changes: 
 dpkg (1.16.9) unstable; urgency=low
 .
   [ Raphaël Hertzog ]
   * Fix dpkg-source regression in "3.0 (quilt)" source packages while
     unapplying patches that remove all files in a directory. Closes: #683547
   * Fix segfault in field format parsing on empty strings, affecting
     «dpkg-query -W -f ''» and «dpkg-deb -W --showformat=''». LP: #1035512
   * Fix dpkg's French usage string which was missing the final “s“ in
     --print-foreign-architectures. Closes: #685863
 .
   [ Guillem Jover ]
   * Use “statoverrides” instead of “statusoverrides” in dpkg-statoverride.
     Closes: #686995
   * Comment out dpkg(1) documentation about disabled --command-fd option.
     Closes: #685677
   * Cleanup dpkg-divert unit-test environment to avoid build failures.
     Closes: #687656
   * Fix update-alternatives test suite to behave correctly on non-Debian
     binary paths. Known to be affecting at least Gentoo and Mac OS X.
   * Do not leak subcall command arguments in update-alternatives.
   * Fix segfault on update-alternatives when passing --slave without any
     action at all. LP: #1037431
   * Fix memory leak in dpkg filesavespackage().
   * Do not print garbage (or worse) on dpkg shared conffile debug output.
   * Use a hash instead of a ref to a hash for keys() in Dpkg::BuildFlags
     get_feature_areas(). This causes compilation failures with older perl
     versions, which can be an issue with partial upgrades.
   * Fix filter subpattern debug output format string to print an actual
     value instead of just blanks.
   * Ignore trailing filter subpattern slashes on reinclusion comparison.
     This makes sure to reinclude directories previously excluded so that
     contained files marked for inclusion do not fail to unpack due to a
     missing directory. Closes: #688416
   * Do not consider obsolete conffiles as actively owned by the package.
     This ensures conffile entries are not misshandled nor mixed up when
     configuring packages owning the non-obsolete conffiles. Closes: #689836
     Based on a patch by Andreas Beckmann <debian@abeckmann.de>.
   * Properly mark in the database obsolete conffiles on package replaces.
   * Sync the Conffiles field values for all package instances. Because
     only the first package instance being configured will have a *.dpkg-new
     conffile available to be processed, the subsequent ones need to use the
     hash from the previously processed entries.
   * Fix logic for previously configured conffiles, so that the shared
     conffile checks actually work on reinstallation. Closes: #684776
   * Avoid info database corruption and bogus accesses on unknown format
     values, by always reading the format file and validating it.
   * Clarify that the most probable reason for multiarch database
     inconcistencies is due to upgrades from unofficial dpkg versions.
   * Only satisfy a dependency on a “Multi-Arch: foreign” if arch-unqualified.
   * Take architecture into account in virtual packages on remove and
     configure dpkg actions. Closes: #683411
   * Update update-alternatives --query format and examples in man page to
     match the implementation.
   * Add two missing 3rd person ‘s’ in dpkg-gensymbols(1). Closes: #689863
     Thanks to Paul Menzel <pm.debian@googlemail.com>.
   * Fix regression on old-style binNMUs for packages that specify an
     explicit binary version to dpkg-gencontrol, by always fixing up the
     source version. Closes: #690823
 .
   [ Updated programs translations ]
   * Catalan (Guillem Jover).
   * Czech (Miroslav Kure).
   * Danish (Joe Dalton). Closes: #690808
   * French (Christian Perrier).
   * German (Sven Joachim).
   * Italian (Milo Casagrande).
   * Japanese (Kenshi Muto).
   * Polish (Michał Kułach). Closes: #690449
   * Portuguese (Miguel Figueiredo). Closes: #682582, #690431
   * Russian (Yuri Kozlov). Closes: #688050, #690415
   * Slovak (Ivan Masár). Closes: #690426
   * Swedish (Peter Krefting).
   * Thai (Theppitak Karoonboonyanan). Closes: #690678
   * Traditional Chinese (imacat). Closes: #687002
 .
   [ Updated scripts translations ]
   * Polish (Michał Kułach). Closes: #683104
   * Spanish (Omar Campagne). Closes: #685297
 .
   [ Updated dselect translations ]
   * Basque (Iñaki Larrañaga Murgoitio). Closes: #686421
   * Czech (Miroslav Kure).
   * Danish (Joe Dalton). Closes: #689820
   * Polish (Michał Kułach).
 .
   [ Updated man page translations ]
   * French (Thomas Vincent, Sylvestre Ledru, Christian Perrier).
     Closes: #682978, #683221
   * German (Helge Kreutzmann).
   * Japanese (Hideki Yamane). Closes: #685103
   * Polish (Michał Kułach).
   * Spanish (Omar Campagne, Guillem Jover). Closes: #683514
   * Swedish (Peter Krefting).
Checksums-Sha1: 
 a2c07bdb82ccedfcb39d723ba027c5a4aa2129b2 1372 dpkg_1.16.9.dsc
 c48dd955f77afdc5eca959b96265b65cfddd665c 3697752 dpkg_1.16.9.tar.xz
 440a5b7dcb214806cc33e176047f38c343fe03d9 683802 libdpkg-dev_1.16.9_amd64.deb
 274eb53df3dc169bfd8cf5b28ff881c81fecb62f 2560574 dpkg_1.16.9_amd64.deb
 8c07b71368e1106c1351261b3209a2044137dc69 1139408 dselect_1.16.9_amd64.deb
 957f7176c9c49cf49cf544d5e126b6fc687b1fa8 1284714 dpkg-dev_1.16.9_all.deb
 ccf04b508ff8ebaef80dfd124648a5609282a82f 945662 libdpkg-perl_1.16.9_all.deb
Checksums-Sha256: 
 a492260b9e89b22d45b880e0bab6ef9377924e7959bac4bd855a3187b0211146 1372 dpkg_1.16.9.dsc
 73cd7fba4e54acddd645346b4bc517030b9c35938e82215d3eeb8b4e7af26b7a 3697752 dpkg_1.16.9.tar.xz
 b6c2ea087b4adb60f2191c5d31ee6cd00124f506310ac518efedec3e81942a62 683802 libdpkg-dev_1.16.9_amd64.deb
 4c76dedc1f2034db55290bb0383bfa9fead04529d5e0120d4eed1484928f8007 2560574 dpkg_1.16.9_amd64.deb
 a5f31f92267ca9aeeba62a56fdaabb2c4128c339dc77fbc5d9132d717c0c1fa6 1139408 dselect_1.16.9_amd64.deb
 bad74f181cd4f3141d77cfeab38e6c3acf522a4561cc9f584d16306a22734c99 1284714 dpkg-dev_1.16.9_all.deb
 cd8cd00d1c0967afbdfc0bc438ed096886be66454415b26de39335102a1c0307 945662 libdpkg-perl_1.16.9_all.deb
Files: 
 0039f955d73857978e10d32b35288c6d 1372 admin required dpkg_1.16.9.dsc
 4df9319b2d17e19cdb6fe94dacee44da 3697752 admin required dpkg_1.16.9.tar.xz
 22d31dbc426fda5fb6f654392d9e17f0 683802 libdevel optional libdpkg-dev_1.16.9_amd64.deb
 3d3a605e2aa043e4994b15bb8c507977 2560574 admin required dpkg_1.16.9_amd64.deb
 e9d13809f18ac4c1ad4c81ee545d2c72 1139408 admin optional dselect_1.16.9_amd64.deb
 fcbb110845d049570bb375a00f7dcc61 1284714 utils optional dpkg-dev_1.16.9_all.deb
 4bb2ffb948ce93d329795fac6ddc5a3b 945662 perl optional libdpkg-perl_1.16.9_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlCCLP4ACgkQuW9ciZ2SjJvEWwCfWHivEoGLMHDGYJTTv12Xd7x1
nDsAoPB9nO02ri8r6sHGHDyLh05qJsIB
=CQKA
-----END PGP SIGNATURE-----




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Wed, 28 Nov 2012 07:27:24 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Fri Apr 18 19:22:45 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.