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

r6101 - in glibc-package/branches/glibc-branch-wheezy/debian: . debhelper.in patches patches/any



Author: aurel32
Date: 2014-05-21 20:54:18 +0000 (Wed, 21 May 2014)
New Revision: 6101

Added:
   glibc-package/branches/glibc-branch-wheezy/debian/patches/any/local-ldconfig-ignore-ld.so.diff
Modified:
   glibc-package/branches/glibc-branch-wheezy/debian/changelog
   glibc-package/branches/glibc-branch-wheezy/debian/debhelper.in/libc-alt.postrm
   glibc-package/branches/glibc-branch-wheezy/debian/debhelper.in/libc.postrm
   glibc-package/branches/glibc-branch-wheezy/debian/debhelper.in/libc.preinst
   glibc-package/branches/glibc-branch-wheezy/debian/patches/series
Log:
* any/local-ldconfig-ignore-ld.so.diff: new patch to ignore the dynamic
  linker in ldconfig.  Closes: #699206, #707185, #727786, #736097,
  #739734, #739758.
* debian/debhelper.in/libc.preinst: Disable ldconfig when a potentially
  broken dynamic loader symlink is found and when a fixed version hasn't
  already been unpacked. This happens when a biarch package of the same
  architecture than the native one has been installed (e.g.: 
  libc6-amd64:i386 on amd64) and ldconfig is run afterwards. Don't fail
  if the dynamic loader symlink is dangling or missing.  Closes: #740158,
  #740196.
* debian/debhelper.in/libc.postrm: generalize the dynamic linker
  symlink creation to all biarch packages.
* debian/debhelper.in/libc-alt.postrm: generalize the dynamic linker
  symlink removal to all biarch packages.

Modified: glibc-package/branches/glibc-branch-wheezy/debian/changelog
===================================================================
--- glibc-package/branches/glibc-branch-wheezy/debian/changelog	2014-05-21 20:54:09 UTC (rev 6100)
+++ glibc-package/branches/glibc-branch-wheezy/debian/changelog	2014-05-21 20:54:18 UTC (rev 6101)
@@ -5,6 +5,20 @@
     upstream to fix February month name in de_AT locale.  Closes: #738544.
   * debian/patches/mips/cvs-backtrace.diff: new patch from upstream to
     fix backtrace() on mips.  Closes: #741354.
+  * any/local-ldconfig-ignore-ld.so.diff: new patch to ignore the dynamic
+    linker in ldconfig.  Closes: #699206, #707185, #727786, #736097,
+    #739734, #739758.
+  * debian/debhelper.in/libc.preinst: Disable ldconfig when a potentially
+    broken dynamic loader symlink is found and when a fixed version hasn't
+    already been unpacked. This happens when a biarch package of the same
+    architecture than the native one has been installed (e.g.: 
+    libc6-amd64:i386 on amd64) and ldconfig is run afterwards. Don't fail
+    if the dynamic loader symlink is dangling or missing.  Closes: #740158,
+    #740196.
+  * debian/debhelper.in/libc.postrm: generalize the dynamic linker
+    symlink creation to all biarch packages.
+  * debian/debhelper.in/libc-alt.postrm: generalize the dynamic linker
+    symlink removal to all biarch packages.
 
  -- Aurelien Jarno <aurel32@debian.org>  Mon, 05 May 2014 14:21:03 +0200
 

Modified: glibc-package/branches/glibc-branch-wheezy/debian/debhelper.in/libc-alt.postrm
===================================================================
--- glibc-package/branches/glibc-branch-wheezy/debian/debhelper.in/libc-alt.postrm	2014-05-21 20:54:09 UTC (rev 6100)
+++ glibc-package/branches/glibc-branch-wheezy/debian/debhelper.in/libc-alt.postrm	2014-05-21 20:54:18 UTC (rev 6101)
@@ -2,11 +2,13 @@
 set -e
 
 if [ "$1" = remove ]; then
-    ARCH=${DPKG_MAINTSCRIPT_ARCH:-$(dpkg --print-architecture)}
-    if [ "${ARCH}" = "amd64" ] && [ "LIBC-FLAVOR" = "libc6-i386" ]; then
-	if [ -h /lib/ld-linux.so.2 ] && [ ! -f /lib/ld-linux.so.2 ]; then
-	    rm /lib/ld-linux.so.2
-	fi
+    # Native multiarch packages declare a Replaces: on the corresponding
+    # biarch package. Therefore if both a biarch package and the corresponding
+    # multiarch package are installed, then the multiarch package is removed,
+    # and then the biarch package is removed, the dynamic linker symlink
+    # becomes a dangling symlink. Remove it in that case.
+    if [ -h RTLD_SO ] && [ ! -f RTLD_SO ]; then
+        rm RTLD_SO
     fi
 fi
 

Modified: glibc-package/branches/glibc-branch-wheezy/debian/debhelper.in/libc.postrm
===================================================================
--- glibc-package/branches/glibc-branch-wheezy/debian/debhelper.in/libc.postrm	2014-05-21 20:54:09 UTC (rev 6100)
+++ glibc-package/branches/glibc-branch-wheezy/debian/debhelper.in/libc.postrm	2014-05-21 20:54:18 UTC (rev 6101)
@@ -9,13 +9,23 @@
 	    suidunregister -s LIBC /usr/libexec/pt_chown
 	fi
     fi
+    # When both the multiarch and the corresponding biarch packages are
+    # installed, removing the multiarch package will remove the dynamic
+    # linker. Recreate it in the postinst.
     ARCH=${DPKG_MAINTSCRIPT_ARCH:-$(dpkg --print-architecture)}
-    if [ "${ARCH}" = "i386" ]; then
-	if [ -f /lib32/ld-linux.so.2 ] && [ ! -f /lib/ld-linux.so.2 ]; then
-	    ln -sf /lib32/ld-linux.so.2 /lib/ld-linux.so.2
-	elif [ -h /lib/ld-linux.so.2 ] && [ ! -f /lib/ld-linux.so.2 ]; then
-	    rm /lib/ld-linux.so.2
-	fi
+    case "${ARCH}" in
+        kfreebsd-i386 | s390 | powerpc)
+            target="/lib32/ld.so.1"
+            ;;
+        i386 | sparc)
+            target="/lib32/ld-linux.so.2"
+            ;;
+        *)
+            target="$(dpkg-query -L LIBC-${ARCH} 2>/dev/null | grep -E '/lib.*/ld-[0-9.]+\.so$' || true)"
+            ;;
+    esac
+    if [ -f "$target" ] && ! [ -f RTLD_SO ] ; then
+        ln -sf ${target#$(dirname RTLD_SO)/} RTLD_SO
     fi
 fi
 

Modified: glibc-package/branches/glibc-branch-wheezy/debian/debhelper.in/libc.preinst
===================================================================
--- glibc-package/branches/glibc-branch-wheezy/debian/debhelper.in/libc.preinst	2014-05-21 20:54:09 UTC (rev 6100)
+++ glibc-package/branches/glibc-branch-wheezy/debian/debhelper.in/libc.preinst	2014-05-21 20:54:18 UTC (rev 6101)
@@ -262,8 +262,15 @@
 
     # Try to detect copies of the libc library in the various places
     # the dynamic linker uses.
-    ldfile=$(readlink -e RTLD_SO)
-    ldbytes=$(head -c 20 RTLD_SO | od -c)
+    ldfile=$(readlink -m RTLD_SO)
+    if test -f "$file"; then
+        ldbytes=$(head -c 20 RTLD_SO | od -c)
+    else
+        # If the symlink to the dynamic linker is dangling or missing, set
+        # ldbytes to an empty string, the test below will fail and all the
+        # libraries found will be ignored.
+        ldbytes=""
+    fi
     libcfiles=$(dpkg-query -L $(package_name) 2>/dev/null)
 
     dirs="SLIBDIR /lib /lib/tls /lib32 /lib64 /usr/local/lib /usr/local/lib32 /usr/local/lib64"
@@ -300,6 +307,26 @@
             exit 1
         fi
     fi
+
+    # ldconfig might have broken the ld.so symlink in case a biarch package
+    # of the same architecture than the native one has been installed (e.g.:
+    # libc6-amd64:i386 on amd64). Try to detect this by checking that the 
+    # ld.so symlink correctly points to ld-*.so in the slib directory, and 
+    # disabling ldconfig if it is not the case and the new version hasn't
+    # been unpacked yet. The symlink will be fixed when unpacking the new 
+    # libc version and ldconfig will be re-enabled when a new fixed version
+    # is unpacked.
+    if ! readlink -m RTLD_SO | grep -qE 'SLIBDIR/ld-[0-9.]+\.so' ; then
+        # The unpack order is not guaranteed, only disable ldconfig if 
+        # a "broken" version is installed.
+        libc_bin_version=$(dpkg-query -W -f='${Version}' libc-bin)
+        if dpkg --compare-versions "$libc_bin_version" lt "2.13-38+deb7u2"; then
+            echo "Warning: found a potentially broken dynamic loader symlink,"
+            echo "disabling ldconfig to avoid a possible system breakage. It"
+            echo "will be reenabled when a new version of libc-bin is unpacked." 
+            ln -sf /bin/true /sbin/ldconfig
+        fi
+    fi
 fi
 
 if [ "$type" != abort-upgrade ]

Added: glibc-package/branches/glibc-branch-wheezy/debian/patches/any/local-ldconfig-ignore-ld.so.diff
===================================================================
--- glibc-package/branches/glibc-branch-wheezy/debian/patches/any/local-ldconfig-ignore-ld.so.diff	                        (rev 0)
+++ glibc-package/branches/glibc-branch-wheezy/debian/patches/any/local-ldconfig-ignore-ld.so.diff	2014-05-21 20:54:18 UTC (rev 6101)
@@ -0,0 +1,56 @@
+diff --git a/elf/ldconfig.c b/elf/ldconfig.c
+index 4211f4c..6425f8e 100644
+--- a/elf/ldconfig.c
++++ b/elf/ldconfig.c
+@@ -450,6 +450,23 @@ chroot_stat (const char *real_path, const char *path, struct stat64 *st)
+   return ret;
+ }
+ 
++static const char * const ld_sonames[] =
++{
++  "ld-kfreebsd-x86-64.so.1",
++  "ld-linux-aarch64.so.1",
++  "ld-linux-aarch64_be.so.1",
++  "ld-linux-armhf.so.3",
++  "ld-linux-ia64.so.2",
++  "ld-linux-mipsn8.so.1",
++  "ld-linux-x32.so.2",
++  "ld-linux-x86-64.so.2",
++  "ld-linux.so.2",
++  "ld-linux.so.3",
++  "ld.so.1",
++  "ld64.so.1",
++  "ld64.so.2",
++};
++
+ /* Create a symbolic link from soname to libname in directory path.  */
+ static void
+ create_links (const char *real_path, const char *path, const char *libname,
+@@ -460,6 +477,7 @@ create_links (const char *real_path, const char *path, const char *libname,
+   struct stat64 stat_lib, stat_so, lstat_so;
+   int do_link = 1;
+   int do_remove = 1;
++  int i;
+   /* XXX: The logics in this function should be simplified.  */
+ 
+   /* Get complete path.  */
+@@ -488,6 +506,18 @@ create_links (const char *real_path, const char *path, const char *libname,
+ 	  error (0, 0, _("Can't stat %s\n"), full_libname);
+ 	  return;
+ 	}
++
++      /* Do not change the symlink pointer to the dynamic linker except for
++	 non-existing symlinks, as it might break break multiarch systems.  */
++      for (i = 0; i < sizeof (ld_sonames) / sizeof (ld_sonames[0]); i++)
++	if (__glibc_unlikely(!strcmp(soname, ld_sonames[i])))
++	  {
++	    if (opt_verbose)
++	      error (0, 0, _("%s is the dynamic linker, ignoring\n"),
++			     full_libname);
++	    do_link = 0;
++	  }
++
+       if (stat_lib.st_dev == stat_so.st_dev
+ 	  && stat_lib.st_ino == stat_so.st_ino)
+ 	/* Link is already correct.  */
+

Modified: glibc-package/branches/glibc-branch-wheezy/debian/patches/series
===================================================================
--- glibc-package/branches/glibc-branch-wheezy/debian/patches/series	2014-05-21 20:54:09 UTC (rev 6100)
+++ glibc-package/branches/glibc-branch-wheezy/debian/patches/series	2014-05-21 20:54:18 UTC (rev 6101)
@@ -385,3 +385,4 @@
 any/cvs-CVE-2013-4458.diff
 any/cvs-CVE-2013-4788.diff
 any/cvs-findlocale-div-by-zero.diff
+any/local-ldconfig-ignore-ld.so.diff


Reply to: