• Bug#1006655: [PATCH] Implement rm_conffile_if_unmodified

    From Guillem Jover@1:229/2 to Josh Triplett on Thu May 30 01:10:01 2024
    XPost: linux.debian.bugs.dist
    From: guillem@debian.org

    Control: forcemerge 330256 -1

    Hi,

    On Tue, 2024-05-28 at 14:28:49 -0700, Josh Triplett wrote:
    tags 1006655 + patch
    thanks

    I've attached a patch implementing an rm_conffile_if_unmodifed command
    for dpkg-maintscript-helper, as well as a declarative version for debian/conffiles.

    I've included documentation and tests for both.

    Using this has the same effect as rm_conffile if the file is unmodified. However, if the file is modified, this leaves the file in place under
    the existing name (treating it as an obsolete conffile so that it still
    gets removed if purging the package).

    Thus, unlike rm_conffile, this version is useful for packages that still support reading the configuration file if present, and thus don't want
    to move existing modified configuration aside with a .dpkg-bak suffix, because that'll prevent the modified configuration from being used.

    As I mentioned in #822462, I think the default should be changed instead
    to do this. I sat yesterday to see how much this would imply code wise
    and ended up with a smallish patch, which then required adapting few test cases. I also added a new --assert-unmodified-obsolete-conffile-removal (although I'm not entirely happy with such a long name). I'd still need
    to add a few more tests for downgrades, but otherwise it seems to work
    fine.

    Being this such a behavior change, although it seems pretty safe to
    me, I think it would still deserve to be discussed in debian-dpkg and debian-devel. The only problematic thing that comes to mind, is that
    it will be harder to spot conffiles that need to be marked as remove-on-upgrade, as test systems would automatically get rid of
    unmodified conffiles.

    Will try to add the missing tests and push this into a branch tomorrow,
    and then try to start a thread on the mailing lists during the week or so.

    Regards,
    Guillem

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)