Sfoglia il codice sorgente

dpkg: Activate file triggers for conffiles on purge

The code has never activated triggers for conffiles on purge, the code
before commit 65ade6390b47fe3ec6a0e2ba341f3d553bf4 was activating them
on removal, which was obviously wrong.

Stable-Candidate: 1.17.x
Reported-by: Helmut Grohne <helmut@subdivi.de>
Guillem Jover 10 anni fa
parent
commit
2f065fc151
2 ha cambiato i file con 10 aggiunte e 0 eliminazioni
  1. 3 0
      debian/changelog
  2. 7 0
      src/remove.c

+ 3 - 0
debian/changelog

@@ -22,6 +22,9 @@ dpkg (1.18.8) UNRELEASED; urgency=medium
     Thanks to Niall Walsh <niallwalsh@celtux.org>. Closes: #824542
   * Set primary group to 0 in dpkg when running as root.
     Reported by Stuart Prescott <stuart@debian.org>.
+  * Activate file triggers for conffiles on purge, which has never happened
+    before. Before dpkg 1.17.0, conffiles were triggered on removal, which
+    was obviously wrong. Reported by Helmut Grohne <helmut@subdivi.de>.
   * Perl modules:
     - Use warnings::warnif() instead of carp() for deprecated warnings.
     - Add new format_range() method and deprecate dpkg() and rfc822() methods

+ 7 - 0
src/remove.c

@@ -514,6 +514,7 @@ static void removal_bulk_remove_configfiles(struct pkginfo *pkg) {
     modstatdb_note(pkg);
 
     for (conff= pkg->installed.conffiles; conff; conff= conff->next) {
+      struct filenamenode *namenode, *usenode;
     static struct varbuf fnvb, removevb;
       struct varbuf_state removevb_state;
 
@@ -527,6 +528,12 @@ static void removal_bulk_remove_configfiles(struct pkginfo *pkg) {
             conff->name, rc == -1 ? "<rc == -1>" : fnvb.buf);
       if (rc == -1)
         continue;
+
+      namenode = findnamenode(fnvb.buf, fnn_nonew);
+      usenode = namenodetouse(namenode, pkg, &pkg->installed);
+
+      trig_path_activate(usenode, pkg);
+
       conffnameused = fnvb.used;
       if (unlink(fnvb.buf) && errno != ENOENT && errno != ENOTDIR)
         ohshite(_("cannot remove old config file '%.250s' (= '%.250s')"),