From: Guillem Jover Date: Thu, 10 Jul 2008 06:12:11 +0000 (+0300) Subject: Do not leave new conffile as .dpkg-new when it has been diverted X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a960ffff2b8ff08d924e5e4fcba8fec640b43be;p=dpkg 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 --- diff --git a/ChangeLog b/ChangeLog index 4ddf9622..5eeb6264 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-07-10 Guillem Jover , + Timothy G Abbott + + * 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 * src/main.h: Remove comment about side effect in namenodetouse. diff --git a/debian/changelog b/debian/changelog index 63f3d52f..7b807bc8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 diff --git a/src/configure.c b/src/configure.c index 5bf60d5c..09240209 100644 --- a/src/configure.c +++ b/src/configure.c @@ -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;