Explorar o código

dpkg: correctly handle a hardlink pointing to a conffile

Normal files tagged as a conffile are not tagged with
fnnf_deferred_rename and due to this the hardlinking code
was assuming that the target is in its final location
already. This is obviously not the case for a conffile.

Fix the code so that the hardlinking logic takes into account
the fact that conffiles are unpacked in .dpkg-new and stay
there until the configuration phase.

Reported-by: Igor Pashev <pashev.igor@gmail.com>
Raphaël Hertzog %!s(int64=15) %!d(string=hai) anos
pai
achega
277e572fac
Modificáronse 2 ficheiros con 2 adicións e 1 borrados
  1. 1 0
      debian/changelog
  2. 1 1
      src/archives.c

+ 1 - 0
debian/changelog

@@ -99,6 +99,7 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * dpkg-source now properly cleans up the temporary tarball generated for
     native formats in case of unexpected interruption. Closes: #631494
   * Fix simplification logic of union dependencies. Closes: #637564
+  * Fix dpkg's handling of a hardlink pointing to a conffile. Closes: #638291
 
   [ Guillem Jover ]
   * Install deb-src-control(5) man pages in dpkg-dev. Closes: #620520

+ 1 - 1
src/archives.c

@@ -764,7 +764,7 @@ tarobject(void *ctx, struct tar_entry *ti)
     varbuf_add_char(&hardlinkfn, '/');
     linknode = findnamenode(ti->linkname, 0);
     varbuf_add_str(&hardlinkfn, namenodetouse(linknode, tc->pkg)->name);
-    if (linknode->flags & fnnf_deferred_rename)
+    if (linknode->flags & (fnnf_deferred_rename|fnnf_new_conff))
       varbuf_add_str(&hardlinkfn, DPKGNEWEXT);
     varbuf_end_str(&hardlinkfn);
     if (link(hardlinkfn.buf,fnamenewvb.buf))