Sfoglia il codice sorgente

dpkg: Properly mark obsolete conffiles on package replaces

This ensures that when taking over conffiles from another package
the obsolete conffiles are marked as such on the other package.
Guillem Jover 13 anni fa
parent
commit
35449e35e0
5 ha cambiato i file con 28 aggiunte e 0 eliminazioni
  1. 1 0
      debian/changelog
  2. 2 0
      src/archives.c
  3. 21 0
      src/help.c
  4. 1 0
      src/main.h
  5. 3 0
      src/processarc.c

+ 1 - 0
debian/changelog

@@ -35,6 +35,7 @@ dpkg (1.16.9) UNRELEASED; urgency=low
     This ensures conffile entries are not misshandled nor mixed up when
     configuring packages owning the non-obsolete conffiles. Closes: #689836
     Based on a patch by Andreas Beckmann <debian@abeckmann.de>.
+  * Properly mark in the database obsolete conffiles on package replaces.
 
   [ Updated programs translations ]
   * Czech (Miroslav Kure).

+ 2 - 0
src/archives.c

@@ -962,6 +962,8 @@ tarobject(void *ctx, struct tar_entry *ti)
   }
 
   if (keepexisting) {
+    if (nifd->namenode->flags & fnnf_new_conff)
+      nifd->namenode->flags |= fnnf_obs_conff;
     remove_file_from_list(tc, ti, oldnifd, nifd);
     tarobject_skip_entry(tc, ti);
     return 0;

+ 21 - 0
src/help.c

@@ -291,6 +291,27 @@ dir_is_used_by_pkg(struct filenamenode *file, struct pkginfo *pkg,
   return false;
 }
 
+/**
+ * Mark a conffile as obsolete.
+ *
+ * @param pkg		The package owning the conffile.
+ * @param namenode	The namenode for the obsolete conffile.
+ */
+void
+conffile_mark_obsolete(struct pkginfo *pkg, struct filenamenode *namenode)
+{
+  struct conffile *conff;
+
+  for (conff = pkg->installed.conffiles; conff; conff = conff->next) {
+    if (strcmp(conff->name, namenode->name) == 0) {
+      debug(dbg_conff, "marking %s conffile %s as obsolete",
+            pkg_name(pkg, pnaw_always), conff->name);
+      conff->obsolete = true;
+      return;
+    }
+  }
+}
+
 void oldconffsetflags(const struct conffile *searchconff) {
   struct filenamenode *namenode;
 

+ 1 - 0
src/main.h

@@ -210,6 +210,7 @@ bool ignore_depends(struct pkginfo *pkg);
 bool force_breaks(struct deppossi *possi);
 bool force_depends(struct deppossi *possi);
 bool force_conflicts(struct deppossi *possi);
+void conffile_mark_obsolete(struct pkginfo *pkg, struct filenamenode *namenode);
 void oldconffsetflags(const struct conffile *searchconff);
 void ensure_pathname_nonexisting(const char *pathname);
 int secure_unlink(const char *pathname);

+ 3 - 0
src/processarc.c

@@ -1351,6 +1351,9 @@ void process_archive(const char *filename) {
         continue;
       }
 
+      if (cfile->namenode->flags & fnnf_new_conff)
+        conffile_mark_obsolete(otherpkg, cfile->namenode);
+
       /* If !fileslistvalid then it's one of the disappeared packages above
        * or we have already updated the files list file, and we don't bother
        * with it here, clearly. */