]> err.no Git - dpkg/commitdiff
Do not leave new conffile as .dpkg-new when it has been diverted
authorGuillem Jover <guillem@debian.org>
Thu, 10 Jul 2008 06:12:11 +0000 (09:12 +0300)
committerGuillem Jover <guillem@debian.org>
Thu, 10 Jul 2008 06:16:17 +0000 (09:16 +0300)
Also properly activate the file trigger for the diverted conffile.
Based on a patch by Timothy G Abbott. Closes: #58735, #476899

ChangeLog
debian/changelog
src/configure.c

index 4ddf96222aafa8f5aaaf02e8c077302630773fb8..5eeb62642514840a9fc8790dd929ceba7e9ea829 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-07-10  Guillem Jover  <guillem@debian.org>,
+            Timothy G Abbott  <tabbott@mega-man.mit.edu>
+
+       * src/configure.c (deferred_configure): Call namenodetouse to handle
+       diverted conffiles. Use trig_file_activate on usenode, instead of
+       trig_file_activate_byname, to activate the correct file trigger for
+       the diverted conffile.
+
 2008-07-06  Guillem Jover  <guillem@debian.org>
 
        * src/main.h: Remove comment about side effect in namenodetouse.
index 63f3d52f3ece045c8098438cd9b584c958e654a1..7b807bc8de297588e497a3e610e38b1ab126b392 100644 (file)
@@ -28,6 +28,9 @@ dpkg (1.15.0) UNRELEASED; urgency=low
   * Print a longer string when a disallowed field value is found when parsing.
   * Use $(filter ...) instead of $(findstring ...) to extract space separated
     options from DEB_BUILD_OPTIONS in debian/rules.
+  * Do not leave new conffile as .dpkg-new when it has been diverted, also
+    properly activate the file trigger for the diverted conffile.
+    Based on a patch by Timothy G Abbott. Closes: #58735, #476899
 
   [ Raphael Hertzog ]
   * Enhance dpkg-shlibdeps's error message when a library can't be found to
index 5bf60d5ca55eaa44c9c1f9122c984c14767f8f7a..092402090b7a71897824d14b741e4b47cc1af01f 100644 (file)
@@ -171,7 +171,12 @@ void deferred_configure(struct pkginfo *pkg) {
                 * processed this one.
                 */
                for (conff= pkg->installed.conffiles; conff; conff= conff->next) {
-                       r= conffderef(pkg, &cdr, conff->name);
+                       struct filenamenode *usenode;
+
+                       usenode = namenodetouse(findnamenode(conff->name,
+                                                            fnn_nocopy), pkg);
+
+                       r = conffderef(pkg, &cdr, usenode->name);
                        if (r == -1) {
                                conff->hash= EMPTY_HASH;
                                continue;
@@ -207,7 +212,8 @@ void deferred_configure(struct pkginfo *pkg) {
                                what= cfo_identical;
                        } else if (!strcmp(currenthash,NONEXISTENTFLAG) && fc_conff_miss) {
                                fprintf(stderr, _("\nConfiguration file `%s', does not exist on system.\n"
-                                                       "Installing new config file as you request.\n"), conff->name);
+                                                 "Installing new config file as you request.\n"),
+                                       usenode->name);
                                what= cfo_newconff;
                                useredited= -1;
                                distedited= -1;
@@ -231,9 +237,11 @@ void deferred_configure(struct pkginfo *pkg) {
 
                        debug(dbg_conff,
                                        "deferred_configure `%s' (= `%s') useredited=%d distedited=%d what=%o",
-                                       conff->name, cdr.buf, useredited, distedited, what);
+                             usenode->name, cdr.buf, useredited, distedited,
+                             what);
 
-                       what=promptconfaction(conff->name, cdr.buf, cdr2.buf, useredited, distedited, what);
+                       what = promptconfaction(usenode->name, cdr.buf, cdr2.buf,
+                                               useredited, distedited, what);
 
                        switch (what & ~(cfof_isnew|cfof_userrmd)) {
                                case cfo_keep | cfof_backup:
@@ -246,7 +254,7 @@ void deferred_configure(struct pkginfo *pkg) {
                                        varbufaddstr(&cdr,DPKGDISTEXT);
                                        varbufaddc(&cdr,0);
                                        strcpy(cdr2rest,DPKGNEWEXT);
-                                       trig_file_activate_byname(conff->name, pkg);
+                                       trig_file_activate(usenode, pkg);
                                        if (rename(cdr2.buf,cdr.buf))
                                                fprintf(stderr,
                                                                _("dpkg: %s: warning - failed to rename `%.250s' to `%.250s': %s\n"),
@@ -279,10 +287,11 @@ void deferred_configure(struct pkginfo *pkg) {
                                                                pkg->name, cdr.buf, cdr2.buf, strerror(errno));
                                        /* fall through */
                                case cfo_install:
-                                       printf(_("Installing new version of config file %s ...\n"),conff->name);
+                                       printf(_("Installing new version of config file %s ...\n"),
+                                              usenode->name);
                                case cfo_newconff:
                                        strcpy(cdr2rest,DPKGNEWEXT);
-                                       trig_file_activate_byname(conff->name, pkg);
+                                       trig_file_activate(usenode, pkg);
                                        if (rename(cdr2.buf,cdr.buf))
                                                ohshite(_("unable to install `%.250s' as `%.250s'"),cdr2.buf,cdr.buf);
                                        break;