The following commit has been merged in the master branch:
commit 216b7a30bab31817dca09ba2c7c629883cee1efa
Author: Guillem Jover <guil...@debian.org>
Date:   Thu May 12 02:57:30 2011 +0200

    dpkg: On purge correctly remove a symlink pointing to a directory
    
    The code was treating symlinks to directories as directories, but then
    it was trying to rmdir(2) them, which failed. In such case just verify
    it's a symlink and unlink(2) them instead.

diff --git a/debian/changelog b/debian/changelog
index 7ce1bfb..9188364 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -61,6 +61,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * On package removal, keep only directories actually containing conffiles,
     and not directories just matching the substring in the conffile or the
     directory itself. Thanks to Ondřej Surý <ond...@debian.org>.
+  * On purge correctly remove symlinks acting as directories, when they are
+    not being used by any other package's files.
 
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312
diff --git a/src/remove.c b/src/remove.c
index a33518d..bb959cb 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -362,6 +362,15 @@ static void removal_bulk_remove_leftover_dirs(struct 
pkginfo *pkg) {
     }
     if (errno != ENOTDIR) ohshite(_("cannot remove `%.250s'"),fnvb.buf);
 
+    if (lstat(fnvb.buf, &stab) == 0 && S_ISLNK(stab.st_mode)) {
+      debug(dbg_eachfiledetail, "removal_bulk is a symlink to a directory");
+
+      if (unlink(fnvb.buf))
+        ohshite(_("cannot remove '%.250s'"), fnvb.buf);
+
+      continue;
+    }
+
     push_leftover(&leftover,namenode);
     continue;
   }

-- 
dpkg's main repository


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

Reply via email to