On Wed, 4 Jan 2012, Jonathan Nieder wrote:
> +     # <http://debbugs.gnu.org/6960>: coreutils mv refuses to
> +     # replace a file by a symlink to the same inode.
> +     # Fine, let's give /usr/lib/git-core/git its own inode.

Or, inspired by http://debbugs.gnu.org/6960#65 , we could move the symlink 
in from a different directory (as long as it’s on the same filesystem), to 
fool mv into not recognizing the symlink target!

--- a/debian/git.preinst
+++ b/debian/git.preinst
@@ -46,12 +46,13 @@ rm_conffile /etc/emacs/site-start.d/50git-core.el "$1" "$2"
 if test "$1" = upgrade &&
    dpkg --compare-versions "$2" lt-nl '1:1.7.7-2'; then
        refinode=$(stat -c%i /usr/lib/git-core/git)
+       tmp=$(mktemp -d --tmpdir=/usr/lib/git-core)
        for f in /usr/lib/git-core/*; do
                test "$f" != /usr/lib/git-core/git || continue
-               rm -f "$f.tmp"
                inode=$(stat -c%i "$f")
                test "$inode" = "$refinode" || continue
-               ln -s git "$f.tmp"
-               mv -f "$f.tmp" "$f"
+               ln -s git "$tmp/symlink"
+               mv -f "$tmp/symlink" "$f"
        done
+       rmdir "$tmp"
 fi

I’ll let you decide which version is less horrible.

Anders



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

Reply via email to