Debian Bug report logs - #574658
dpkg: [CONFFILE] purging conffile replaced by symlink removes target, not symlink

version graph

Package: dpkg; Maintainer for dpkg is Dpkg Developers <debian-dpkg@lists.debian.org>; Source for dpkg is src:dpkg.

Reported by: Jean-Christophe Dubacq <jcdubacq1@free.fr>

Date: Fri, 19 Mar 2010 21:30:01 UTC

Severity: normal

Merged with 648042

Found in version dpkg/1.15.5.6

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#574658; Package dpkg. (Fri, 19 Mar 2010 21:30:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jean-Christophe Dubacq <jcdubacq1@free.fr>:
New Bug report received and forwarded. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. (Fri, 19 Mar 2010 21:30:04 GMT) Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Jean-Christophe Dubacq <jcdubacq1@free.fr>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: dpkg: [CONFFILE] purging conffile replaced by symlink removes target, not symlink
Date: Fri, 19 Mar 2010 22:27:27 +0100
Package: dpkg
Version: 1.15.5.6
Severity: normal

Let's do a small experiment:

root# dpkg -i dummy_1_all.deb 
Selecting previously deselected package dummy.
(Reading database ... 288646 files and directories currently installed.)
Unpacking dummy (from dummy_1_all.deb) ...
Setting up dummy (1) ...
# No postinst, no preinst, nothing
root# cat /var/lib/dpkg/info/dummy.conffiles 
/etc/dummy/test1
root# ls -l /etc/dummy/test1 
-rw-r--r-- 1 root root 9 Mar 18 01:01 /etc/dummy/test1
root# cat /etc/dummy/test1 
coshoopu
root# echo "I am a bug" > /tmp/a
root# rm /etc/dummy/test1; ln -s /tmp/a /etc/dummy/test1; cat /etc/dummy/test1
I am a bug
root# ls -l /etc/dummy/test1 
lrwxrwxrwx 1 root root 6 Mar 19 22:24 /etc/dummy/test1 -> /tmp/a
root# dpkg -P dummy     
(Reading database ... 288643 files and directories currently installed.)
Removing dummy ...
Purging configuration files for dummy ...
dpkg: warning: while removing dummy, directory '/etc/dummy' not empty so not removed.
root# ls -l /etc/dummy/
total 0
lrwxrwxrwx 1 root root 6 Mar 19 22:24 test1 -> /tmp/a
root# ls -l /tmp/a
ls: cannot access /tmp/a: No such file or directory

######################################
The target of the symlink was deleted, not the symlink itself.
This can lead to unexpected user data (I deem this rather unimportant
as it is a cornercase) and leaves garbage behind.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (800, 'unstable'), (700, 'testing'), (500, 'stable'), (50, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages dpkg depends on:
ii  coreutils                     8.4-2      GNU core utilities
ii  libc6                         2.10.2-6   Embedded GNU C Library: Shared lib
ii  lzma                          4.43-14    Compression method of 7z format in

dpkg recommends no packages.

Versions of packages dpkg suggests:
ii  apt                           0.7.25.3   Advanced front-end for dpkg

-- no debconf information




Information forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#574658; Package dpkg. (Tue, 14 Sep 2010 06:09:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Adam M. Costello" <bug.amc+5+@nicemice.net>:
Extra info received and forwarded to list. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. (Tue, 14 Sep 2010 06:09:03 GMT) Full text and rfc822 format available.

Message #10 received at 574658@bugs.debian.org (full text, mbox):

From: "Adam M. Costello" <bug.amc+5+@nicemice.net>
To: 574658@bugs.debian.org
Subject: Re: dpkg: [CONFFILE] purging conffile replaced by symlink removes target, not symlink
Date: Tue, 14 Sep 2010 06:05:12 +0000
I just noticed this behavior too, and I find it astonishing and
worrisome.  I sometimes manually replace a conf file with a symlink
to a file in my own private config directory (example: /etc/foo ->
/mydir/foo).  I always assumed that dpkg remove --purge would remove
the conf file /etc/foo and not touch /mydir/foo, but in fact just the
opposite happens: it removes /mydir/foo and leaves the dangling symlink
/etc/foo. /mydir is mine, not part of any package, so the package system
should not be touching it.

Was there some motivation for this behavior?  It's caused by a call to
conffderef() in remove.c, but what for?

AMC




Forcibly Merged 574658 648042. Request was from Michael Biebl <biebl@debian.org> to control@bugs.debian.org. (Wed, 09 Nov 2011 11:45:28 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Apr 19 02:02:50 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.