Package: dpkg
Version: 1.13.12
Tags: patch

If you locally delete a conffile which the package maintainer then
ships a new version of, you get this message:

Configuration file `/etc/gnome/config/Emacs.ad'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : background this process to examine the situation
 The default action is to keep your current version.
*** Emacs.ad (Y/I/N/O/D/Z) [default=N] ?

It's rather strange to say that the file was `modified' when in fact
it was deleted.  Also, if you say `y' you also get a warning like
this:

  dpkg: capplets-data: warning - failed to link `/etc/gnome/config/Emacs.ad' to 
`/etc/gnome/config/Emacs.ad.dpkg-old': No such file or directory


The enclosed patch produces this message instead:

Configuration file `/etc/gnome/config/Emacs.ad'
 ==> Deleted (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : background this process to examine the situation
 The default action is to keep your current version.
*** Emacs.ad (Y/I/N/O/D/Z) [default=N] ?

Only the first line is different, but this seems sufficiently clear.

Also, the patch suppresses the attempt to make a backup copy of the
nonexistent original file.

FYI, I'm about to include this patch in my next dpkg upload for Ubuntu.

Ian.



--- ../debian/dpkg-1.13.12/src/configure.c      2006-01-18 08:30:03.000000000 
+0000
+++ src/configure.c     2006-02-04 11:44:52.000000000 +0000
@@ -214,6 +214,8 @@
                                useredited= strcmp(conff->hash,currenthash) != 
0;
                                distedited= strcmp(conff->hash,newdisthash) != 
0;
                                what= conffoptcells[useredited][distedited];
+                               if (!strcmp(currenthash,NONEXISTENTFLAG))
+                                       what |= cfof_userrmd;
                        }
 
                        debug(dbg_conff,
@@ -222,7 +224,7 @@
 
                        what=promptconfaction(conff->name, cdr.buf, cdr2.buf, 
useredited, distedited, what);
 
-                       switch (what & ~cfof_isnew) {
+                       switch (what & ~(cfof_isnew|cfof_userrmd)) {
                                case cfo_keep | cfof_backup:
                                        strcpy(cdr2rest,DPKGOLDEXT);
                                        if (unlink(cdr2.buf) && errno != ENOENT)
@@ -258,8 +260,9 @@
                                                fprintf(stderr,
                                                                _("dpkg: %s: 
warning - failed to remove `%.250s' (before overwrite): %s\n"),
                                                                pkg->name, 
cdr2.buf, strerror(errno));
-                                       if (link(cdr.buf,cdr2.buf))
-                                               fprintf(stderr,
+                                       if (!(what & cfof_userrmd))
+                                               if (link(cdr.buf,cdr2.buf))
+                                                       fprintf(stderr,
                                                                _("dpkg: %s: 
warning - failed to link `%.250s' to `%.250s': %s\n"),
                                                                pkg->name, 
cdr.buf, cdr2.buf, strerror(errno));
                                        /* fall through */
@@ -560,9 +563,11 @@
                                                " ==> File on system created by 
you or by a script.\n"
                                                " ==> File also in package 
provided by package maintainer.\n"));
                } else {
-                       fprintf(stderr, useredited ?
+                       fprintf(stderr, !useredited ?
+                                       _("\n     Not modified since 
installation.\n") :
+                                                       !(what & cfof_userrmd) ?
                                        _("\n ==> Modified (by you or by a 
script) since installation.\n") :
-                                       _("\n     Not modified since 
installation.\n"));
+                                       _("\n ==> Deleted (by you or by a 
script) since installation.\n"));
 
                        fprintf(stderr, distedited ?
                                        _(" ==> Package distributor has shipped 
an updated version.\n") :
@@ -646,15 +651,17 @@
        log_message("conffile %s %s", cfgfile,
                    (cc == 'i' || cc == 'y') ? "install" : "keep");
 
+       what &= cfof_userrmd;
+
        switch (cc) {
                case 'i':
                case 'y':
-                       what=cfof_install|cfof_backup;
+                       what |= cfof_install|cfof_backup;
                        break;
 
                case 'n':
                case 'o':
-                       what=cfof_keep|cfof_backup;
+                       what |= cfof_keep|cfof_backup;
                        break;
 
                default:


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to