[Pkg-zsh-devel] Bug#768079: zsh: fails to configure if /bin is a symlink to /usr/bin

Felipe Sateler fsateler at debian.org
Sat Dec 26 01:16:07 UTC 2015


Control: tags -1 patch

On Tue, 04 Nov 2014 21:27:11 +0100 Sven Joachim <svenjoac at gmx.de> wrote:
> On a system with everything in /usr[1,2], i.e. /bin is a symlink to
> /usr/bin, zsh fails to configure:
>
> ,----
> | Setting up zsh (5.0.7-3) ...
> | update-alternatives: using /bin/zsh5 to provide /bin/zsh (zsh) in auto mode
> | update-alternatives: error: unable to install `/usr/bin/zsh.dpkg-tmp' as `/usr/bin/zsh': No such file or directory
> | dpkg: error processing package zsh (--configure):
> |  subprocess installed post-installation script returned error exit status 2
> | Errors were encountered while processing:
> |  zsh
> `----
>
> I guess update-alternatives does not like the fact that the /bin/zsh
> alternative and its slave /usr/bin/zsh are at the same place.

So, I dug up a bit, and the /usr/bin/zsh slave's purpose was to
preserve the /usr/bin path when zsh was moved from /usr to /. Since
this is a slave link that will be updated whenever the master link is
updated (so /bin/zsh and /usr/bin/zsh should always point to the same
place) and nobody else is using this name[1], I propose that the
alternative is simply dropped, and have a symlink from /usr/bin/zsh
point to /bin/zsh. Then that link can be omitted when /bin is a
symlink to /usr/bin.

Please find attached an (untested) patch that does that.


[1] https://codesearch.debian.net/results/zsh-usrbin/page_0 shows zsh
and a test case.

-- 

Saludos,
Felipe Sateler
-------------- next part --------------
diff --git a/debian/zsh.postinst b/debian/zsh.postinst
index 2ba2202..2b4cf39 100644
--- a/debian/zsh.postinst
+++ b/debian/zsh.postinst
@@ -21,13 +21,16 @@ esac
 update-alternatives --remove zsh /usr/bin/zsh
 update-alternatives --remove ksh /usr/bin/zsh
 update-alternatives --remove ksh /bin/zsh4
-update-alternatives --install /bin/zsh zsh /bin/zsh5 51 \
-		--slave /usr/bin/zsh zsh-usrbin /bin/zsh5
+update-alternatives --install /bin/zsh zsh /bin/zsh5 51
 update-alternatives --install /bin/rzsh rzsh /bin/zsh5 51 \
 		--slave /usr/share/man/man1/rzsh.1.gz rzsh.1.gz /usr/share/man/man1/zsh.1.gz
 update-alternatives --remove zsh /bin/zsh4
 update-alternatives --remove rzsh /bin/zsh4
 
+if [ ! -e /usr/bin/zsh ] ; then
+    ln -s /bin/zsh /usr/bin/zsh
+fi
+
 #DEBHELPER#
 
 exit 0
diff --git a/debian/zsh.postrm b/debian/zsh.postrm
index a8921f6..60fe519 100644
--- a/debian/zsh.postrm
+++ b/debian/zsh.postrm
@@ -6,6 +6,9 @@ case "$1" in
 	(remove)
 	remove-shell /bin/zsh
 	remove-shell /usr/bin/zsh
+	if [ -L /usr/bin/zsh ] ; then
+		rm /usr/bin/zsh
+	fi
 	;;
 esac
 


More information about the Pkg-zsh-devel mailing list