[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: apt upgrade merging modified files



On 2021-03-25 04:39 -0400, Michael Grant wrote:

> When I apt-update, sometimes I update something for which I modified a config file and I get this menu:
>
> Configuration file '/etc/matrix-synapse/homeserver.yaml'
>  ==> 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     : start a shell to examine the situation
>  The default action is to keep your current version.
> *** homeserver.yaml (Y/I/N/O/D/Z) [default=N]

This prompt is coming from dpkg which notes that a conffile has been
changed.  In Debian/dpkg jargon, a conffile is a configuration file that
is shipped in a package.  The dpkg program keeps a checksum for each
conffile in its database and can therefore detect modifications, but it
does not track the content of conffiles.

> Sometimes, rarely, I get a 5th option offering to try to merge the
> files.  I don't know what causes the merge option to be available or
> not.

These packages use a different mechanism for their configuration files
based on a program called ucf.  The files are _not_ shipped in the
package, but created from a template in the maintainer scripts.  Unlike
dpkg, ucf also stores the content of these files and is therefore able
to offer merge options.

> Is there some way I can at minimum add a 5th option to the above menu
> to run emacs in emerge mode with those files as args?  This would save
> lazy me the steps of echoing the vars and starting emacs manually.
>
> I run etckeeper, it would be really sweet if this was smart enough to
> attempt a 3-way merge (merge with an ancestor file).

I am afraid this is not easily possible.  Making dpkg's conffile prompt
smarter has been requested many times, but nothing has happened since
bug #32877[1] and its many siblings have been filed.  Yes, that bug is
22 years old.

Cheers,
       Sven


1. https://bugs.debian.org/32877


Reply to: