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

r6782 - in glibc-package/trunk/debian: . debhelper.in



Author: aurel32
Date: 2015-12-07 11:33:09 +0000 (Mon, 07 Dec 2015)
New Revision: 6782

Modified:
   glibc-package/trunk/debian/changelog
   glibc-package/trunk/debian/debhelper.in/libc.preinst
Log:
debian/debhelper.in/libc.preinst: Move tests which might exit with a failure at the beginning



Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog	2015-12-07 09:39:49 UTC (rev 6781)
+++ glibc-package/trunk/debian/changelog	2015-12-07 11:33:09 UTC (rev 6782)
@@ -3,7 +3,7 @@
   [ Aurelien Jarno ]
   * debian/debhelper.in/libc.{preinst,prerm}: remove code handling the
     upgrade from squeeze to wheezy, as we don't support squeeze to stretch
-    upgrades.
+    upgrades. Move tests which might exit with a failure at the beginning.
 
   [ Samuel Thibault ]
   * patches/hurd-i386/cvs-libpthread-api.diff: New patch, cleans libpthread

Modified: glibc-package/trunk/debian/debhelper.in/libc.preinst
===================================================================
--- glibc-package/trunk/debian/debhelper.in/libc.preinst	2015-12-07 09:39:49 UTC (rev 6781)
+++ glibc-package/trunk/debian/debhelper.in/libc.preinst	2015-12-07 11:33:09 UTC (rev 6782)
@@ -99,6 +99,76 @@
     done
 }
 
+if [ "$type" != abort-upgrade ]
+then
+    # See if LD_LIBRARY_PATH contains the traditional /lib, but not the
+    # multiarch path
+    dirs=$(echo $LD_LIBRARY_PATH | sed 's/:/ /g')
+    for dir in $dirs ; do
+        dir=$(readlink -e $dir || true)
+        case "$dir" in
+        /lib)
+            seen_traditional=1
+            ;;
+        SLIBDIR)
+            seen_multiarch=1
+            ;;
+        esac
+    done
+    if test -n "$seen_traditional" && test -z "$seen_multiarch" ; then
+        echo
+        echo "LD_LIBRARY_PATH contains the traditional /lib directory,"
+        echo "but not the multiarch directory SLIBDIR."
+        echo "It is not safe to upgrade the C library in this situation;"
+        echo "please remove the /lib/directory from LD_LIBRARY_PATH and" 
+        echo "try again."
+        echo
+        exit 1
+    fi
+
+    # glibc kernel version check
+    system=`uname -s`
+    if [ "$system" = "Linux" ]
+    then
+        # Test to make sure z < 255, in x.y.z-n form of kernel version
+        # Also make sure we don't trip on x.y.zFOO-n form
+        kernel_rev=$(uname -r | sed 's/\([0-9]*\.\)\{1,2\}\([0-9]*\)\(.*\)/\2/')
+        if [ "$kernel_rev" -ge 255 ]
+        then
+            echo "WARNING: Your kernel version indicates a revision number"
+            echo "of 255 or greater.  Glibc has a number of built in"
+            echo "assumptions that this revision number is less than 255."
+            echo "If you\'ve built your own kernel, please make sure that any"
+            echo "custom version numbers are appended to the upstream"
+            echo "kernel number with a dash or some other delimiter."
+            echo
+            exit 1
+        fi
+
+        # sanity checking for the appropriate kernel on each architecture.
+        kernel_ver=`uname -r`
+
+        # The GNU libc requires a >= 3.2 kernel, found in wheezy
+        if linux_compare_versions "$kernel_ver" lt 3.2
+        then
+            echo WARNING: this version of the GNU libc requires kernel version
+            echo 3.2 or later.  Please upgrade your kernel before installing
+            echo glibc.
+            exit 1
+        fi
+
+    elif [ $system = "GNU/kFreeBSD" ] ; then
+        kernel_ver=`uname -r`
+        if kfreebsd_compare_versions "$kernel_ver" lt 8.3
+        then
+            echo WARNING: this version of the GNU libc requires kernel version
+            echo 8.3 or later.  Please upgrade your kernel before installing
+            echo glibc.
+            exit 1
+        fi
+    fi
+fi
+
 if [ "$type" = upgrade ]
 then
     # Load debconf module if available
@@ -106,6 +176,74 @@
         . /usr/share/debconf/confmodule
     fi
 
+    # Try to detect copies of the libc library in the various places
+    # the dynamic linker uses.
+    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"
+    for dir in $dirs ; do
+        check_dir "in an unexpected directory" $dir
+    done
+
+    if test -n "$LD_LIBRARY_PATH"; then
+        dirs=$(echo $LD_LIBRARY_PATH | sed 's/:/ /g')
+        for dir in $dirs ; do
+            check_dir "via LD_LIBRARY_PATH" $dir
+        done
+    fi
+
+    if test -e /etc/ld.so.conf; then
+        dirs=$(echo $(cat /etc/ld.so.conf))
+        if test -n "$dirs" ; then
+            for dir in $dirs ; do
+                check_dir "via /etc/ld.so.conf" $dir
+            done
+        fi
+    fi
+
+    if [ -e /lib/tls/i686/cmov/libc.so.6 ] || [ -e /lib/i686/cmov/libc.so.6 ] ; then
+        status_i686=$(dpkg -s libc6-i686 2>/dev/null | grep ^Status: | sed -e 's/^Status: \(.*\) \(.*\) \(.*\)/\3/g')
+        status_xen=$(dpkg -s libc6-xen 2>/dev/null | grep ^Status: | sed -e 's/^Status: \(.*\) \(.*\) \(.*\)/\3/g')
+        if ([ -z "$status_i686" ] || [ "$status_i686" = "not-installed" ] || [ "$status_i686" = "config-files" ]) && \
+             ([ -z "$status_xen" ] || [ "$status_xen" = "not-installed" ] || [ "$status_xen" = "config-files" ]); then
+            echo
+            echo "A non-dpkg owned copy of the libc6-i686 package was found."
+            echo "It is not safe to upgrade the C library in this situation;"
+            echo "please remove that copy of the C library and try again."
+            echo
+            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.18-2"; 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
+
     if [ -n "$preversion" ]; then
 	# NSS authentication trouble guard
 	if dpkg --compare-versions "$preversion" lt GLIBC_VERSION; then
@@ -190,149 +328,11 @@
 	fi # end upgrading and $preversion lt GLIBC_VERSION
     fi # Upgrading
 
-    # Try to detect copies of the libc library in the various places
-    # the dynamic linker uses.
-    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"
-    for dir in $dirs ; do
-        check_dir "in an unexpected directory" $dir
-    done
-
-    if test -n "$LD_LIBRARY_PATH"; then
-        dirs=$(echo $LD_LIBRARY_PATH | sed 's/:/ /g')
-        for dir in $dirs ; do
-            check_dir "via LD_LIBRARY_PATH" $dir
-        done
-    fi
-
-    if test -e /etc/ld.so.conf; then
-        dirs=$(echo $(cat /etc/ld.so.conf))
-        if test -n "$dirs" ; then
-            for dir in $dirs ; do
-                check_dir "via /etc/ld.so.conf" $dir
-            done
-        fi
-    fi
-
-    if [ -e /lib/tls/i686/cmov/libc.so.6 ] || [ -e /lib/i686/cmov/libc.so.6 ] ; then
-        status_i686=$(dpkg -s libc6-i686 2>/dev/null | grep ^Status: | sed -e 's/^Status: \(.*\) \(.*\) \(.*\)/\3/g')
-        status_xen=$(dpkg -s libc6-xen 2>/dev/null | grep ^Status: | sed -e 's/^Status: \(.*\) \(.*\) \(.*\)/\3/g')
-        if ([ -z "$status_i686" ] || [ "$status_i686" = "not-installed" ] || [ "$status_i686" = "config-files" ]) && \
-             ([ -z "$status_xen" ] || [ "$status_xen" = "not-installed" ] || [ "$status_xen" = "config-files" ]); then
-            echo
-            echo "A non-dpkg owned copy of the libc6-i686 package was found."
-            echo "It is not safe to upgrade the C library in this situation;"
-            echo "please remove that copy of the C library and try again."
-            echo
-            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.18-2"; 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
-
     # This will keep us from using hwcap libs (optimized) during an
     # upgrade.
     touch /etc/ld.so.nohwcap
 fi
 
-if [ "$type" != abort-upgrade ]
-then
-    # See if LD_LIBRARY_PATH contains the traditional /lib, but not the
-    # multiarch path
-    dirs=$(echo $LD_LIBRARY_PATH | sed 's/:/ /g')
-    for dir in $dirs ; do
-        dir=$(readlink -e $dir || true)
-        case "$dir" in
-        /lib)
-            seen_traditional=1
-            ;;
-        SLIBDIR)
-            seen_multiarch=1
-            ;;
-        esac
-    done
-    if test -n "$seen_traditional" && test -z "$seen_multiarch" ; then
-        echo
-        echo "LD_LIBRARY_PATH contains the traditional /lib directory,"
-        echo "but not the multiarch directory SLIBDIR."
-        echo "It is not safe to upgrade the C library in this situation;"
-        echo "please remove the /lib/directory from LD_LIBRARY_PATH and" 
-        echo "try again."
-        echo
-        exit 1
-    fi
-
-    # glibc kernel version check
-    system=`uname -s`
-    if [ "$system" = "Linux" ]
-    then
-        # Test to make sure z < 255, in x.y.z-n form of kernel version
-        # Also make sure we don't trip on x.y.zFOO-n form
-        kernel_rev=$(uname -r | sed 's/\([0-9]*\.\)\{1,2\}\([0-9]*\)\(.*\)/\2/')
-        if [ "$kernel_rev" -ge 255 ]
-        then
-            echo "WARNING: Your kernel version indicates a revision number"
-            echo "of 255 or greater.  Glibc has a number of built in"
-            echo "assumptions that this revision number is less than 255."
-            echo "If you\'ve built your own kernel, please make sure that any"
-            echo "custom version numbers are appended to the upstream"
-            echo "kernel number with a dash or some other delimiter."
-            echo
-            exit 1
-        fi
-
-        # sanity checking for the appropriate kernel on each architecture.
-        kernel_ver=`uname -r`
-
-        # The GNU libc requires a >= 3.2 kernel, found in wheezy
-        if linux_compare_versions "$kernel_ver" lt 3.2
-        then
-            echo WARNING: this version of the GNU libc requires kernel version
-            echo 3.2 or later.  Please upgrade your kernel before installing
-            echo glibc.
-            exit 1
-        fi
-
-    elif [ $system = "GNU/kFreeBSD" ] ; then
-        kernel_ver=`uname -r`
-        if kfreebsd_compare_versions "$kernel_ver" lt 8.3
-        then
-            echo WARNING: this version of the GNU libc requires kernel version
-            echo 8.3 or later.  Please upgrade your kernel before installing
-            echo glibc.
-            exit 1
-        fi
-    fi
-fi
-
 # We now use the multiarch triplet instead of the GNU triplet for the ld.so
 # configuration file, in order to keep a stable path. Remove the old file.
 case ${DPKG_MAINTSCRIPT_ARCH:-$(dpkg --print-architecture)} in


Reply to: