Parcourir la source

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
Guillem Jover il y a 18 ans
Parent
commit
3a960ffff2
3 fichiers modifiés avec 27 ajouts et 7 suppressions
  1. 8 0
      ChangeLog
  2. 3 0
      debian/changelog
  3. 16 7
      src/configure.c

+ 8 - 0
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>
 2008-07-06  Guillem Jover  <guillem@debian.org>
 
 
 	* src/main.h: Remove comment about side effect in namenodetouse.
 	* src/main.h: Remove comment about side effect in namenodetouse.

+ 3 - 0
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.
   * Print a longer string when a disallowed field value is found when parsing.
   * Use $(filter ...) instead of $(findstring ...) to extract space separated
   * Use $(filter ...) instead of $(findstring ...) to extract space separated
     options from DEB_BUILD_OPTIONS in debian/rules.
     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 ]
   [ Raphael Hertzog ]
   * Enhance dpkg-shlibdeps's error message when a library can't be found to
   * Enhance dpkg-shlibdeps's error message when a library can't be found to

+ 16 - 7
src/configure.c

@@ -171,7 +171,12 @@ void deferred_configure(struct pkginfo *pkg) {
 		 * processed this one.
 		 * processed this one.
 		 */
 		 */
 		for (conff= pkg->installed.conffiles; conff; conff= conff->next) {
 		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) {
 			if (r == -1) {
 				conff->hash= EMPTY_HASH;
 				conff->hash= EMPTY_HASH;
 				continue;
 				continue;
@@ -207,7 +212,8 @@ void deferred_configure(struct pkginfo *pkg) {
 				what= cfo_identical;
 				what= cfo_identical;
 			} else if (!strcmp(currenthash,NONEXISTENTFLAG) && fc_conff_miss) {
 			} else if (!strcmp(currenthash,NONEXISTENTFLAG) && fc_conff_miss) {
 				fprintf(stderr, _("\nConfiguration file `%s', does not exist on system.\n"
 				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;
 				what= cfo_newconff;
 				useredited= -1;
 				useredited= -1;
 				distedited= -1;
 				distedited= -1;
@@ -231,9 +237,11 @@ void deferred_configure(struct pkginfo *pkg) {
 
 
 			debug(dbg_conff,
 			debug(dbg_conff,
 					"deferred_configure `%s' (= `%s') useredited=%d distedited=%d what=%o",
 					"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)) {
 			switch (what & ~(cfof_isnew|cfof_userrmd)) {
 				case cfo_keep | cfof_backup:
 				case cfo_keep | cfof_backup:
@@ -246,7 +254,7 @@ void deferred_configure(struct pkginfo *pkg) {
 					varbufaddstr(&cdr,DPKGDISTEXT);
 					varbufaddstr(&cdr,DPKGDISTEXT);
 					varbufaddc(&cdr,0);
 					varbufaddc(&cdr,0);
 					strcpy(cdr2rest,DPKGNEWEXT);
 					strcpy(cdr2rest,DPKGNEWEXT);
-					trig_file_activate_byname(conff->name, pkg);
+					trig_file_activate(usenode, pkg);
 					if (rename(cdr2.buf,cdr.buf))
 					if (rename(cdr2.buf,cdr.buf))
 						fprintf(stderr,
 						fprintf(stderr,
 								_("dpkg: %s: warning - failed to rename `%.250s' to `%.250s': %s\n"),
 								_("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));
 								pkg->name, cdr.buf, cdr2.buf, strerror(errno));
 					/* fall through */
 					/* fall through */
 				case cfo_install:
 				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:
 				case cfo_newconff:
 					strcpy(cdr2rest,DPKGNEWEXT);
 					strcpy(cdr2rest,DPKGNEWEXT);
-					trig_file_activate_byname(conff->name, pkg);
+					trig_file_activate(usenode, pkg);
 					if (rename(cdr2.buf,cdr.buf))
 					if (rename(cdr2.buf,cdr.buf))
 						ohshite(_("unable to install `%.250s' as `%.250s'"),cdr2.buf,cdr.buf);
 						ohshite(_("unable to install `%.250s' as `%.250s'"),cdr2.buf,cdr.buf);
 					break;
 					break;