[Reproducible-commits] [dpkg] 15/32: dpkg: Unpack missing shared directories when the package is replaced

Holger Levsen holger at layer-acht.org
Tue May 3 08:43:13 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to annotated tag 1.15.10
in repository dpkg.

commit d460aac069a68f1115c8a26f07c147e42816e2b1
Author: Guillem Jover <guillem at debian.org>
Date:   Wed Jun 29 04:11:32 2011 +0200

    dpkg: Unpack missing shared directories when the package is replaced
    
    Cherry picked from commit b6ca9bcdb5887e30fe65ecd2105da9dcd55a351c.
    
    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
---
 debian/changelog |  4 ++++
 src/archives.c   | 26 ++++++++++++++++----------
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 58e170a..8e859c8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,9 @@
 dpkg (1.15.8.12) UNRELEASED; urgency=low
 
+  [ Guillem Jover ]
+  * Do not fail to unpack shared directories missing on the file system
+    from packages being replaced by other packages. Closes: #631808
+
   [ Updated man page translations ]
   * German (Helge Kreutzmann). Minor fixe(s).
 
diff --git a/src/archives.c b/src/archives.c
index 63d713a..7189045 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -565,6 +565,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:
@@ -618,6 +627,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' "
@@ -626,16 +636,12 @@ tarobject(void *ctx, struct tar_entry *ti)
                       versiondescribe(&otherpkg->installed.version,
                                       vdew_nonambig));
         } else {
-          /* WTA: 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));
         }
       }
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list