Sfoglia il codice sorgente

* main/remove.c (removal_bulk_remove_configfiles): Don't change the
"previous pointer" pointer if we remove the node from the linked list,
ensuring that if the next node is to be removed the right thing will
happen. This corrects the bug where every second shared or diverted
conffile would be incorrectly deleted by dpkg.

Scott James Remnant 22 anni fa
parent
commit
2f3cdb851e
3 ha cambiato i file con 16 aggiunte e 3 eliminazioni
  1. 10 0
      ChangeLog
  2. 4 0
      debian/changelog
  3. 2 3
      main/remove.c

+ 10 - 0
ChangeLog

@@ -1,3 +1,13 @@
+Fri Mar 12 19:02:21 GMT 2004 Scott James Remnant <scott@netsplit.com>
+
+  * main/remove.c (removal_bulk_remove_configfiles): Don't change the
+  "previous pointer" pointer if we remove the node from the linked list,
+  ensuring that if the next node is to be removed the right thing will
+  happen.
+
+  This corrects the bug where every second shared or diverted conffile
+  would be incorrectly deleted by dpkg.
+ 
 Fri Mar 12 15:05:52 GMT 2004 Scott James Remnant <scott@netsplit.com>
 Fri Mar 12 15:05:52 GMT 2004 Scott James Remnant <scott@netsplit.com>
 
 
   * utils/start-stop-daemon.c: Don't require an argument for -V (version).
   * utils/start-stop-daemon.c: Don't require an argument for -V (version).

+ 4 - 0
debian/changelog

@@ -1,6 +1,10 @@
 dpkg (1.10.21) unstable; urgency=low
 dpkg (1.10.21) unstable; urgency=low
 
 
   * Don't require argument for start-stop-daemon -V.  Closes: #237589.
   * Don't require argument for start-stop-daemon -V.  Closes: #237589.
+  * Fix incorrect linked list node removal code that caused every second
+    shared or diverted conffile to be deleted by dpkg.
+    Closes: #10879, #33046, #47267, #90623, #98210, #109691, #146167.
+    Closes: #155456, #204275.
 
 
  -- Scott James Remnant <scott@netsplit.com>  UNRELEASED
  -- Scott James Remnant <scott@netsplit.com>  UNRELEASED
 
 

+ 2 - 3
main/remove.c

@@ -403,9 +403,7 @@ static void removal_bulk_remove_configfiles(struct pkginfo *pkg) {
      * are involved in diversions, except if we are the package doing the
      * are involved in diversions, except if we are the package doing the
      * diverting.
      * diverting.
      */
      */
-    for (lconffp= &pkg->installed.conffiles;
-         (conff= *lconffp) != 0;
-         lconffp= &conff->next) {
+    for (lconffp= &pkg->installed.conffiles; (conff= *lconffp) != 0; ) {
       for (searchfile= pkg->clientdata->files;
       for (searchfile= pkg->clientdata->files;
            searchfile && strcmp(searchfile->namenode->name,conff->name);
            searchfile && strcmp(searchfile->namenode->name,conff->name);
            searchfile= searchfile->next);
            searchfile= searchfile->next);
@@ -422,6 +420,7 @@ static void removal_bulk_remove_configfiles(struct pkginfo *pkg) {
       } else {
       } else {
         debug(dbg_conffdetail,"removal_bulk set to new conffile `%s'",conff->name);
         debug(dbg_conffdetail,"removal_bulk set to new conffile `%s'",conff->name);
         conff->hash= NEWCONFFILEFLAG; /* yes, cast away const */
         conff->hash= NEWCONFFILEFLAG; /* yes, cast away const */
+        lconffp= &conff->next;
       }
       }
     }
     }
     modstatdb_note(pkg);
     modstatdb_note(pkg);