If deferred_configure_conffile() is interrupted after the
.dpkg-new file is removed but before its hash is recorded as the
distributed conffile hash, that hash is lost forever, and if it
is different from the previous one then the conffile will appear
to have been modified by the user the next time an upgrade
modifies that conffile.

Fixing this should avoid unnecessary prompting in some cases.

Signed-off-by: Jonathan Nieder <[email protected]>
---
 src/configure.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/configure.c b/src/configure.c
index 29878e4..e4fffc9 100644
--- a/src/configure.c
+++ b/src/configure.c
@@ -183,10 +183,6 @@ deferred_configure_conffile(struct pkginfo *pkg, struct 
conffile *conff)
                                pkg->name, cdr2.buf, cdr.buf, strerror(errno));
                /* Fall through. */
        case cfo_keep:
-               strcpy(cdr2rest, DPKGNEWEXT);
-               if (unlink(cdr2.buf))
-                       warning(_("%s: failed to remove '%.250s': %s"),
-                               pkg->name, cdr2.buf, strerror(errno));
                break;
        case cfo_install | cfof_backup:
                strcpy(cdr2rest, DPKGDISTEXT);
@@ -220,11 +216,6 @@ deferred_configure_conffile(struct pkginfo *pkg, struct 
conffile *conff)
                if (rename(cdr2.buf, cdr.buf))
                        ohshite(_("unable to install `%.250s' as `%.250s'"),
                                cdr2.buf, cdr.buf);
-               strcpy(cdr2rest, DPKGNEWEXT);
-               if (unlink(cdr2.buf))
-                       warning(_("%s: failed to remove '%.250s': %s"),
-                               pkg->name, cdr2.buf, strerror(errno));
-               break;
        default:
                internerr("unknown conffopt '%d'", what);
        }
@@ -232,6 +223,11 @@ deferred_configure_conffile(struct pkginfo *pkg, struct 
conffile *conff)
        conff->hash = nfstrsave(newdisthash);
        modstatdb_note(pkg);
 
+       strcpy(cdr2rest, DPKGNEWEXT);
+       if (unlink(cdr2.buf))
+               warning(_("%s: failed to remove '%.250s': %s"),
+                       pkg->name, cdr2.buf, strerror(errno));
+
        varbuffree(&cdr);
        varbuffree(&cdr2);
 }
-- 
1.6.5.2


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

Reply via email to