Package: dpkg
Version: 1.16.1.2
Severity: normal

Consider the following:

 1. A package foo, version 1-1, with a conffile /etc/foo.cfg
 3. Version 1-1 of foo is installed on a user's system
 4. The user rebuilds foo, changing the version by appending 'local1'
    (e.g., by running "dch -l local") and installs the rebuilt package
 2. Version 2-1 of foo, that removes /etc/foo.cfg by invoking
    dpkg-maintscript-helper's  rm_conffile action

When the user upgrades from foo 1-1local1 to 2-1, the following
maintainer scripts are executed:

 1. foo 1-1local1: prerm    upgrade   2-1
 2. foo 2-1:       preinst  upgrade   1-1local1
 3. foo 1-1local1: postrm   upgrade   2-1
 4. foo 2-1:       postinst configure 1-1local1

In foo 2-1's preinst, we have the line:

 dpkg-maintscript-helper rm_conffile 1-1 /etc/foo.cfg

dpkg-maintscript-helper contains the following code:

 if [ "$1" = "install" -o "$1" = "upgrade" ] && [ -n "$2" ] &&
    dpkg --compare-versions "$2" le-nl "$LASTVERSION"; then
         prepare_rm_conffile "$CONFFILE" "$PACKAGE"
 fi

The version check will fail because of the local version applied by the
user:

 $ dpkg --compare-versions 1-1local1 le-nl 1-1; echo $?
 1

And the conffile will not be removed.

Is the user in the wrong here? debian-faq says no, as it specifically
advises the user of dch -l when performing a local build. The user
cannot know when he's rebuilding the package that a subsequent version
will remove the conffile, and the package maintainer cannot know that a
user has rebuilt the package locally.

The same will happen when NMUs are prepared, if the package maintainer
is not careful about the version number that they invoke rm_conffile
with.

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (530, 'testing'), (520, 'unstable'), (510, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages dpkg depends on:
ii  coreutils    8.13-3
ii  libbz2-1.0   1.0.6-1
ii  libc6        2.13-24
ii  libselinux1  2.1.0-4.1
ii  xz-utils     5.1.1alpha+20110809-3
ii  zlib1g       1:1.2.3.4.dfsg-3

dpkg recommends no packages.

Versions of packages dpkg suggests:
ii  apt  0.8.15.9

-- Configuration Files:
/etc/dpkg/dpkg.cfg changed [not included]

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-dpkg-bugs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to