On Thu, 15 Dec 2011, Raphael Hertzog wrote:
> Yeah, that's not correct. The attached patch should fix this. It's
> untested though and it would be great if you could confirm that it works
> as expected.

It turns out it was not enough as dpkg will try to disappear the packages
also when it installs other packages (that just happen to share some
directories with the M-A: same packages).

Here's an updated version of the patch. It's also more restrictive than
the former one since it will refuse to disappear M-A: same packages simply
due to their file sharing, but it will allow such disappearence for the
non M-A: same cases. It seemed logical to allow this in the spirit of
supporting cross-grades (overwriting a M-A: foreign package by one of
another arch can then automatically disappear the former one).

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Pre-order a copy of the Debian Administrator's Handbook and help
liberate it: http://debian-handbook.info/liberation/
commit 64c51324c656612bda90eef71643ddfad94e3288
Author: Raphaël Hertzog <[email protected]>
Date:   Thu Dec 15 10:28:30 2011 +0100

    dpkg: do not try to disappear other packages from the same set
    
    Packages within a set can rightfully share files and should not
    be disappeared in the case where they share all the files!
    
    Closes: #652063
    Reported-by: Martin Pitt <[email protected]>

diff --git a/src/archives.c b/src/archives.c
index e32185a..cf1dd0e 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -152,6 +152,13 @@ filesavespackage(struct fileinlist *file,
     if (thirdpkg == pkgbeinginstalled || thirdpkg == pkgtobesaved)
       continue;
 
+    /* A Multi-Arch: same package can share files and their presence in a
+     * third package of the same set is not a sign that we can get rid of
+     * it. */
+    if (pkgtobesaved->installed.multiarch == multiarch_same &&
+        thirdpkg->set == pkgtobesaved->set)
+      continue;
+
     /* If !fileslistvalid then we've already disappeared this one, so
      * we shouldn't try to make it take over this shared directory. */
     debug(dbg_eachfiledetail,"filesavespackage ...  is 3rd package");
diff --git a/src/processarc.c b/src/processarc.c
index f783670..eed8683 100644
--- a/src/processarc.c
+++ b/src/processarc.c
@@ -1253,6 +1253,12 @@ void process_archive(const char *filename) {
         otherpkg->status == stat_configfiles ||
        otherpkg->clientdata->istobe == itb_remove ||
         !otherpkg->clientdata->files) continue;
+    /* Do not try to disappear other packages from the same set
+     * if they are Multi-Arch: same */
+    if (pkg->installed.multiarch == multiarch_same &&
+        otherpkg->installed.multiarch == multiarch_same &&
+        otherpkg->set == pkg->set)
+      continue;
     debug(dbg_veryverbose, "process_archive checking disappearance %s",
           pkg_name(otherpkg, pno_nonambig));
     assert(otherpkg->clientdata->istobe == itb_normal ||

Reply via email to