Since debian-1.7.4.1-1~34 (2011-01-06), git's postinst checked if
/usr/share/doc/contrib/emacs is a directory on upgrade from squeeze
before replacing it with a symlink.  In debian-1.7.4.1-2~1
(2011-02-26), responsibility for the symlink moved to the git-el
package, which does this check on first install.

Unfortunately, the "is a directory" check uses 'test -d'; the latter
uses stat(2), not lstat(2), so it succeeds whether or not
doc/contrib/emacs has already been replaced with a symlink.  So when
installing git-el from scratch for the first time:

 1. Unpacking git-el produces a contrib/emacs symlink.
 2. Configuring git-el produces confusion:

        rmdir: failed to remove `/usr/share/doc/git/contrib/emacs': Not a 
directory
        Moving /usr/share/doc/git/contrib/emacs to emacs.old

Checking with '! test -L && test -d' instead of 'test -d' alone fixes
it.

Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
---
 debian/changelog       |    7 +++++++
 debian/git-el.postinst |    4 +++-
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index c02f203..2bdfe17 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+git (1:1.7.4.1-3.1) experimental; urgency=low
+
+  * git-el.postinst: check if /usr/share/doc/git/contrib/emacs is
+    already a symlink before making room for one.
+
+ -- Jonathan Nieder <jrnie...@gmail.com>  Wed, 09 Mar 2011 16:52:14 -0600
+
 git (1:1.7.4.1-3) unstable; urgency=low
 
   [ Anders Kaseorg ]
diff --git a/debian/git-el.postinst b/debian/git-el.postinst
index 96b4933..18af229 100644
--- a/debian/git-el.postinst
+++ b/debian/git-el.postinst
@@ -5,8 +5,10 @@ test "$1" = configure || exit 0
 
 # Replace the old /usr/share/doc/git/contrib/emacs directory
 # with a symlink.
-test -z "$2" || exit 0
+test -z "$2" &&
+! test -L /usr/share/doc/git/contrib/emacs &&
 test -d /usr/share/doc/git/contrib/emacs || exit 0
+
 if ! rmdir /usr/share/doc/git/contrib/emacs; then
   echo Moving /usr/share/doc/git/contrib/emacs to emacs.old >&2
   mv -f /usr/share/doc/git/contrib/emacs /usr/share/doc/git/contrib/emacs.old
-- 
1.7.4.1




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

Reply via email to