Hi!

On Wed, 2015-10-07 at 03:29:10 +0200, Andreas Beckmann wrote:
> The chroot was bootstrapped with
> 
> 'debootstrap' '--variant=minbase' 
> '--keyring=/usr/share/keyrings/debian-archive-keyring.gpg' 
> '--components=main' '--arch=amd64' 'jessie' '/tmp/piupartss/tmpcNOJI3' 
> 'http://ftp.de.debian.org/debian'
> 
> and was slightly configured by piuparts to have e.g.
> 
> # cat /etc/apt/apt.conf.d/piuparts 
> APT::Get::Assume-Yes "yes";
> APT::Install-Recommends "0";
> APT::Install-Suggests "0";
> APT::Get::AllowUnauthenticated "No";
> Acquire::PDiffs "false";
> Acquire::http::Proxy "http://localhost:3128";;
> Dpkg::Options {"--force-unsafe-io";};

Thanks for the recipe. I was going through the code to see why this
might be happening and realized that it is most probably caused by
systemd being in triggers-pending state, which the code was not taking
into account. I've prepared a patch, but I've not yet setup the test
environment, if you have it ready, could you try to test a dpkg with
this patch to see if it fixed it for you?

I think I might instead create a reduced test case for the dpkg-tests
functional test suite, which should be faster to reproduce and retest.

Thanks,
Guillem
From 61a5fbc39deb116eec20db7757cf0a00ac8d5a0d Mon Sep 17 00:00:00 2001
From: Guillem Jover <guil...@debian.org>
Date: Sat, 10 Oct 2015 16:06:41 +0200
Subject: [PATCH] libdpkg: Config-Version should also be initialized on
 triggers-pending

A package in triggers-pending state should be considered an installed
package, by not doing so we might end up not passing the correct version
to the configure maintainer script and making it look like we are doing
a configuration for a first install, instead of an upgrade.

Closes: #801156
Reported-by: Andreas Beckmann <a...@debian.org>
Stable-Candidate: 1.16.x 1.17.x
---
 lib/dpkg/parse.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index 043a164..c06626a 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -225,19 +225,24 @@ pkg_parse_verify(struct parsedb_state *ps,
       if (!dop->arch)
         dop->arch = pkgbin->arch;
 
-  /* Check the Config-Version information:
-   * If there is a Config-Version it is definitely to be used, but
-   * there shouldn't be one if the package is ‘installed’ (in which case
-   * the Version and/or Revision will be copied) or if the package is
-   * ‘not-installed’ (in which case there is no Config-Version). */
+  /*
+   * Check the Config-Version information:
+   *
+   * If there is a Config-Version it is definitely to be used, but there
+   * should not be one if the package is ‘installed’ or ‘triggers-pending’
+   * (in which case the Version and/or Revision will be copied) or if the
+   * package is ‘not-installed’ (in which case there is no Config-Version).
+   */
   if (!(ps->flags & pdb_recordavailable)) {
     if (pkg->configversion.version) {
       if (pkg->status == PKG_STAT_INSTALLED ||
-          pkg->status == PKG_STAT_NOTINSTALLED)
+          pkg->status == PKG_STAT_NOTINSTALLED ||
+          pkg->status == PKG_STAT_TRIGGERSPENDING)
         parse_error(ps,
                     _("Config-Version for package with inappropriate Status"));
     } else {
-      if (pkg->status == PKG_STAT_INSTALLED)
+      if (pkg->status == PKG_STAT_INSTALLED ||
+          pkg->status == PKG_STAT_TRIGGERSPENDING)
         pkg->configversion = pkgbin->version;
     }
   }
-- 
2.6.1

Reply via email to