Package: dpkg
Version: 1.20.6
Severity: grave
Justification: breaks unrelated packages by removing their conffiles

Hi Guillem,

attached is a small package demonstrating the misbehavior of
remove-on-upgrade which may delete symlink targets. It builds foo.deb
(which has 'remove-on-upgrade /etc/old-conffile') and bar.deb (which
has /etc/old-conffile -> /etc/new-conffile).

# dpkg -i /tmp/bar_1_all.deb
Selecting previously unselected package bar.
(Reading database ... 14303 files and directories currently installed.)
Preparing to unpack /tmp/bar_1_all.deb ...
Unpacking bar (1) ...
Setting up bar (1) ...
# dpkg --verify bar
# dpkg -i /tmp/foo_1_all.deb
Selecting previously unselected package foo.
(Reading database ... 14307 files and directories currently installed.)
Preparing to unpack /tmp/foo_1_all.deb ...
Unpacking foo (1) ...
Setting up foo (1) ...
Obsolete conffile '/etc/new-conffile' has been modified by you.
Saving as /etc/new-conffile.dpkg-old ...
# dpkg --verify bar
??5?????? c /etc/new-conffile


The actual bug where I encountered this misbehavior is
  #994971: OpenCL not working with latest Nvidia driver
and it was an error of debhelper converting rm_conffile to remove-on-upgrade
but dpkg played its part by deleting the symlink target instead of the
symlink itself, but it should rather do nothing (or print a diagnostic) if
the to-be-removed file is not a plain file.

At least there is an error if it is a directory:

# mkdir /etc/old-conffile
# dpkg -i /tmp/foo_1_all.deb
Selecting previously unselected package foo.
(Reading database ... 14304 files and directories currently installed.)
Preparing to unpack /tmp/foo_1_all.deb ...
Unpacking foo (1) ...
Setting up foo (1) ...
dpkg: warning: foo: conffile '/etc/old-conffile' is not a plain file or symlink 
(= '/etc/old-conffile')


Simplified, the nvidia use case the following:

Long ago, /etc/conffile was a conffile
That was later removed with rm_conffile
and since then the different co-installable drivers ship 
/etc/conffile-$driver_version instead
and a slave alternative exists as /etc/conffile pointing to the corresponding 
file of
the activated driver variant.
(The different drivers may require slightly different conffile content.)

Andreas

Attachment: dpkg-bug-remove-on-upgrade.tar.gz
Description: application/gzip

Reply via email to