[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

r4891 - in glibc-package/trunk/debian: . debhelper.in rules.d sysdeps



Author: vorlon
Date: 2011-08-19 05:49:47 +0000 (Fri, 19 Aug 2011)
New Revision: 4891

Modified:
   glibc-package/trunk/debian/changelog
   glibc-package/trunk/debian/debhelper.in/libc.install
   glibc-package/trunk/debian/debhelper.in/libc.preinst
   glibc-package/trunk/debian/debhelper.in/libc.prerm
   glibc-package/trunk/debian/rules.d/debhelper.mk
   glibc-package/trunk/debian/sysdeps/amd64.mk
   glibc-package/trunk/debian/sysdeps/kfreebsd-amd64.mk
   glibc-package/trunk/debian/sysdeps/ppc64.mk
   glibc-package/trunk/debian/sysdeps/s390x.mk
   glibc-package/trunk/debian/sysdeps/sparc64.mk
Log:
fix for bug #632682

Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog	2011-08-18 22:11:37 UTC (rev 4890)
+++ glibc-package/trunk/debian/changelog	2011-08-19 05:49:47 UTC (rev 4891)
@@ -25,8 +25,16 @@
   * debian/patches/hurd-i386/submitted-ioctl-unsigned-size_t.diff: Add
     u?int{8,16,32,64} ioctl types.
 
- -- Samuel Thibault <sthibault@debian.org>  Fri, 19 Aug 2011 00:10:09 +0200
+  [ Steve Langasek ]
+  * Install ld*.so to RTLDDIR (/lib64 or /lib), as appropriate, and convert
+    /lib64 from a symlink to a directory on upgrade (with appropriate
+    downgrade and error-unwind handling), so that multiarch and biarch
+    packages will play nicely together on the filesystem..  Thanks to
+    Sven Joachim <svenjoac@gmx.de> for preliminary patches.  Closes: #632682.
+  * Restore multiarch support on all architectures.
 
+ -- Aurelien Jarno <aurel32@debian.org>  Tue, 09 Aug 2011 11:40:02 +0200
+
 eglibc (2.13-16) unstable; urgency=low
 
   [ Aurelien Jarno ]

Modified: glibc-package/trunk/debian/debhelper.in/libc.install
===================================================================
--- glibc-package/trunk/debian/debhelper.in/libc.install	2011-08-18 22:11:37 UTC (rev 4890)
+++ glibc-package/trunk/debian/debhelper.in/libc.install	2011-08-19 05:49:47 UTC (rev 4891)
@@ -1,4 +1,4 @@
-TMPDIR/lib/*.so* /lib
+TMPDIR/lib/*.so* RTLDDIR
 TMPDIR/SLIBDIR/*.so* SLIBDIR
 TMPDIR/LIBDIR/gconv/* LIBDIR/gconv
 

Modified: glibc-package/trunk/debian/debhelper.in/libc.preinst
===================================================================
--- glibc-package/trunk/debian/debhelper.in/libc.preinst	2011-08-18 22:11:37 UTC (rev 4890)
+++ glibc-package/trunk/debian/debhelper.in/libc.preinst	2011-08-19 05:49:47 UTC (rev 4891)
@@ -118,6 +118,31 @@
     done
 }
 
+# On upgrade, if /lib64 is a symlink, remove it and replace it with a real
+# directory so we can ensure biarch and multiarch packages play nicely
+# together
+remove_lib64_symlink() {
+    ldfile=$(readlink -e RTLD_SO)
+    # Test if libc is of the same architecture as coreutils
+    # If not, they almost surely have a multiarch system and we can use
+    # the native ELF interpreter
+    if ! $ldfile /bin/true 2>/dev/null; then
+        interpreter=
+    else
+        interpreter=$ldfile
+    fi
+
+    mkdir /lib64.eglibc-new
+    ln -s $ldfile /lib64.eglibc-new/$(basename RTLD_SO)
+    # sync before and after the operation to reduce the danger of hosing
+    # the system
+    sync
+    rm -f /lib64
+    $interpreter /bin/mv /lib64.eglibc-new /lib64
+    sync
+    rm -f /lib/$(basename RTLD_SO)
+}
+
 if [ "$type" = upgrade ]
 then
     # Remove old /etc/init.d/glibc.sh init script
@@ -383,6 +408,18 @@
 
 #DEBHELPER#
 
+case $type in
+    upgrade|abort-upgrade)
+        if test -L /lib64 && dpkg --compare-versions "$2" lt 2.13-17; then
+            case ${DPKG_MAINTSCRIPT_ARCH:-$(dpkg --print-architecture)} in
+                amd64 | kfreebsd-amd64 | ppc64 | sparc64 | s390x)
+                    remove_lib64_symlink
+                    ;;
+            esac
+        fi
+        ;;
+esac
+
 if [ -n "$preversion" ]; then
     if dpkg --compare-versions "$preversion" lt 2.13-5; then
        # upgrading from a pre-multiarch libc to a multiarch libc; we have

Modified: glibc-package/trunk/debian/debhelper.in/libc.prerm
===================================================================
--- glibc-package/trunk/debian/debhelper.in/libc.prerm	2011-08-18 22:11:37 UTC (rev 4890)
+++ glibc-package/trunk/debian/debhelper.in/libc.prerm	2011-08-19 05:49:47 UTC (rev 4891)
@@ -7,8 +7,56 @@
     preversion=$2
 fi
 
+restore_lib64_symlink() {
+# Downgrading from a version with a /lib64 directory to a version with
+# a /lib64 symlink is extremely dangerous.  We need to move the
+# directory aside and restore the symlink, otherwise the dynamic
+# linker gets lost after unpacking the replacing version.
+
+    ldfile=$(readlink -e RTLD_SO)
+    # Test if libc is of the same architecture as coreutils
+    # If not, they almost surely have a multiarch system and we can use
+    # the native ELF interpreter
+    if ! $ldfile /bin/true 2>/dev/null; then
+	interpreter=
+    else
+	interpreter=$ldfile
+    fi
+
+    # Create the symlink in /lib again
+    cp -a RTLD_SO /lib/
+
+    # sync before and after the operation to reduce the danger of hosing
+    # the system
+    sync
+    # See if they have anything in /lib64 besides the ELF interpreter.
+    # If yes, move the directory aside so they can restore it later,
+    # otherwise we just remove it.
+    if ls -1A /lib64 | grep -vq "^$(basename RTLD_SO)$"; then
+	echo "Warning: /lib64 not empty during libc downgrade, renaming it to /lib64.eglibc-old"
+	mv /lib64 /lib64.eglibc-old
+    else
+	rm -rf /lib64
+    fi
+
+    $interpreter /bin/ln -s /lib /lib64
+    sync
+}
+
+
 #DEBHELPER#
 
+if [ "$type" = upgrade ]; then
+    if dpkg --compare-versions "$preversion" lt 2.13-17; then
+	if ! test -L /lib64; then
+	    case ${DPKG_MAINTSCRIPT_ARCH:-$(dpkg --print-architecture)} in
+		amd64 | kfreebsd-amd64 | ppc64 | sparc64 | s390x)
+		    restore_lib64_symlink ;;
+	    esac
+	fi
+    fi
+fi
+
 if [ -n "$preversion" ]; then
     if dpkg --compare-versions "$preversion" lt 2.13-5; then
         # downgrading from a multiarch libc to a pre-multiarch libc; we have

Modified: glibc-package/trunk/debian/rules.d/debhelper.mk
===================================================================
--- glibc-package/trunk/debian/rules.d/debhelper.mk	2011-08-18 22:11:37 UTC (rev 4890)
+++ glibc-package/trunk/debian/rules.d/debhelper.mk	2011-08-19 05:49:47 UTC (rev 4891)
@@ -109,19 +109,7 @@
 
 	dh_installdeb -p$(curpass)
 	dh_shlibdeps -p$(curpass)
-
-	#
-	# Disable multiarch support on some architectures until we fix the /lib64 -> /lib issue
-	#
-	case $(curpass)/$(DEB_HOST_ARCH) in \
-	libc6/amd64 | libc0.1/kfreebsd-amd64 | libc6/ppc64 | libc6/s390x | libc6/sparc64) \
-		dh_gencontrol -p$(curpass) -- -UMulti-Arch \
-		;; \
-	*) \
-		dh_gencontrol -p$(curpass) \
-		;; \
-	esac
-
+	dh_gencontrol -p$(curpass)
 	if [ $(curpass) = nscd ] ; then \
 		sed -i -e "s/\(Depends:.*libc[0-9.]\+\)-[a-z0-9]\+/\1/" debian/nscd/DEBIAN/control ; \
 	fi

Modified: glibc-package/trunk/debian/sysdeps/amd64.mk
===================================================================
--- glibc-package/trunk/debian/sysdeps/amd64.mk	2011-08-18 22:11:37 UTC (rev 4890)
+++ glibc-package/trunk/debian/sysdeps/amd64.mk	2011-08-19 05:49:47 UTC (rev 4891)
@@ -1,10 +1,7 @@
 libc_rtlddir = /lib64
 extra_config_options = --enable-multi-arch
 
-# /lib64 and /usr/lib64 are provided by glibc instead base-files: #259302.
 define libc6_extra_pkg_install
-ln -sf /lib debian/$(curpass)/lib64
-ln -sf lib debian/$(curpass)/usr/lib64
 
 make -C debian/local/memcpy-wrapper
 install -m 755 -o root -g root -d debian/libc6/$(libdir)/libc

Modified: glibc-package/trunk/debian/sysdeps/kfreebsd-amd64.mk
===================================================================
--- glibc-package/trunk/debian/sysdeps/kfreebsd-amd64.mk	2011-08-18 22:11:37 UTC (rev 4890)
+++ glibc-package/trunk/debian/sysdeps/kfreebsd-amd64.mk	2011-08-19 05:49:47 UTC (rev 4891)
@@ -1,12 +1,6 @@
 # Main library
 extra_config_options = --disable-compatible-utmp --disable-multi-arch
 
-# /lib64 and /usr/lib64 are provided by glibc instead base-files: #259302.
-define libc0.1_extra_pkg_install
-ln -sf /lib debian/$(curpass)/lib64
-ln -sf lib debian/$(curpass)/usr/lib64
-endef
-
 # build 32-bit (i386) alternative library
 EGLIBC_PASSES += i386
 DEB_ARCH_REGULAR_PACKAGES += libc0.1-i386 libc0.1-dev-i386

Modified: glibc-package/trunk/debian/sysdeps/ppc64.mk
===================================================================
--- glibc-package/trunk/debian/sysdeps/ppc64.mk	2011-08-18 22:11:37 UTC (rev 4890)
+++ glibc-package/trunk/debian/sysdeps/ppc64.mk	2011-08-19 05:49:47 UTC (rev 4891)
@@ -1,12 +1,6 @@
 libc_rtlddir = /lib64
 extra_config_options = --enable-multi-arch
 
-# /lib64 and /usr/lib64 are provided as symlinks 
-define libc6_extra_pkg_install
-ln -sf /lib debian/$(curpass)/lib64
-ln -sf lib debian/$(curpass)/usr/lib64
-endef
-
 # build 32-bit (powerpc) alternative library
 EGLIBC_PASSES += powerpc
 DEB_ARCH_REGULAR_PACKAGES += libc6-powerpc libc6-dev-powerpc

Modified: glibc-package/trunk/debian/sysdeps/s390x.mk
===================================================================
--- glibc-package/trunk/debian/sysdeps/s390x.mk	2011-08-18 22:11:37 UTC (rev 4890)
+++ glibc-package/trunk/debian/sysdeps/s390x.mk	2011-08-19 05:49:47 UTC (rev 4891)
@@ -1,11 +1,5 @@
 libc_rtlddir = /lib64
 
-# /lib64 and /usr/lib64 are provided by glibc instead base-files: #259302.
-define libc6_extra_pkg_install
-ln -sf /lib debian/$(curpass)/lib64
-ln -sf lib debian/$(curpass)/usr/lib64
-endef
-
 # build 32-bit (s390) alternative library
 EGLIBC_PASSES += s390
 DEB_ARCH_REGULAR_PACKAGES += libc6-s390 libc6-dev-s390

Modified: glibc-package/trunk/debian/sysdeps/sparc64.mk
===================================================================
--- glibc-package/trunk/debian/sysdeps/sparc64.mk	2011-08-18 22:11:37 UTC (rev 4890)
+++ glibc-package/trunk/debian/sysdeps/sparc64.mk	2011-08-19 05:49:47 UTC (rev 4891)
@@ -1,9 +1,3 @@
 extra_config_options = --disable-multi-arch
 libc_rtlddir = /lib64
 libc_extra_cflags = -mcpu=ultrasparc
-
-# /lib64 and /usr/lib64 are provided by glibc instead base-files: #259302.
-define libc6_extra_pkg_install
-ln -sf lib debian/$(curpass)/lib64
-ln -sf lib debian/$(curpass)/usr/lib64
-endef


Reply to: