The following commit has been merged in the master branch:
commit b6ca9bcdb5887e30fe65ecd2105da9dcd55a351c
Author: Guillem Jover <guil...@debian.org>
Date:   Wed Jun 29 04:11:32 2011 +0200

    dpkg: Unpack missing shared directories when the package is replaced
    
    When unpacking a directory missing in the file system with that path
    shared by at least one other package, from a package that is Replaced
    by other packages, assume the missing path is a shared directory and
    avoid setting ‘keepexisting’ and as such returning prematurely from
    tarobject(), because in that case we need to recreate the lost
    directory. As a side effect this also prevents printing the message
    “Replaced by files in installed package” which is bogus in this case,
    as directories are always shared.
    
    Regression introduced in commit 00e5640a99be03aba40c9e08a663b90d8f8aa797.
    
    Closes: #631808

diff --git a/debian/changelog b/debian/changelog
index 902e952..eac87b4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -113,6 +113,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Run du with --apparent-size when generating the Installed-Size field in
     dpkg-gencontrol to get consistent results independent of build system.
     Thanks to Ludovic Brenta <ludo...@ludovic-brenta.org>. Closes: #630533
+  * Do not fail to unpack shared directories missing on the file system
+    from packages being replaced by other packages. Closes: #631808
 
   [ Bill Allombert]
   * Add support for Build-Features: build-arch. Closes: #229357
diff --git a/src/archives.c b/src/archives.c
index 878095c..7ea26f4 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -583,6 +583,15 @@ tarobject(void *ctx, struct tar_entry *ti)
           continue;
       }
 
+      /* If the new object is a directory and the previous object does
+       * not exist assume it's also a directory and skip further checks.
+       * XXX: Ideally with more information about the installed files we
+       * could perform more clever checks. */
+      if (statr != 0 && ti->type == tar_filetype_dir) {
+        debug(dbg_eachfile, "tarobject ... assuming shared directory");
+        continue;
+      }
+
       /* Nope? Hmm, file conflict, perhaps. Check Replaces. */
       switch (otherpkg->clientdata->replacingfilesandsaid) {
       case 2:
@@ -636,6 +645,7 @@ tarobject(void *ctx, struct tar_entry *ti)
         nifd->namenode->flags &= ~fnnf_new_inarchive;
         keepexisting = true;
       } else {
+        /* At this point we are replacing something without a Replaces. */
         if (!statr && S_ISDIR(stab.st_mode)) {
           forcibleerr(fc_overwritedir,
                       _("trying to overwrite directory '%.250s' "
@@ -644,16 +654,12 @@ tarobject(void *ctx, struct tar_entry *ti)
                       versiondescribe(&otherpkg->installed.version,
                                       vdew_nonambig));
         } else {
-          /* At this point we are replacing something without a Replaces.
-           * If the new object is a directory and the previous object does
-           * not exist assume it's also a directory and don't complain. */
-          if (!(statr && ti->type == tar_filetype_dir))
-            forcibleerr(fc_overwrite,
-                        _("trying to overwrite '%.250s', "
-                          "which is also in package %.250s %.250s"),
-                        nifd->namenode->name, otherpkg->name,
-                        versiondescribe(&otherpkg->installed.version,
-                                        vdew_nonambig));
+          forcibleerr(fc_overwrite,
+                      _("trying to overwrite '%.250s', "
+                        "which is also in package %.250s %.250s"),
+                      nifd->namenode->name, otherpkg->name,
+                      versiondescribe(&otherpkg->installed.version,
+                                      vdew_nonambig));
         }
       }
     }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to