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

Bug#630077: preinst fails with Linux 3.0



Package: eglibc
Version: 2.13-6
Severity: normal
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch oneiric

libc.preinst gets rather upset if your kernel identifies itself as 3.0
(as noted in https://lkml.org/lkml/2011/6/10/309).  Here's a patch that
Andy reports as fixing it.

*Building* eglibc on a 3.0 kernel may be a rather different matter.  I
haven't tried that ...

=== modified file 'debian/debhelper.in/libc.preinst'
--- debian/debhelper.in/libc.preinst	2011-06-09 15:44:22 +0000
+++ debian/debhelper.in/libc.preinst	2011-06-10 16:04:31 +0000
@@ -25,8 +25,8 @@ rm_conffile() {
 }
 
 linux_compare_versions () {
-    verA=$(($(echo "$1" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 10000 + \2 \* 100 + \3/')))
-    verB=$(($(echo "$3" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 10000 + \2 \* 100 + \3/')))
+    verA=$(($(echo "$1" | sed 's/^\([0-9]*\.[0-9]*\)\([^.0-9]\|$\)/\1.0\2/; s/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 10000 + \2 \* 100 + \3/')))
+    verB=$(($(echo "$3" | sed 's/^\([0-9]*\.[0-9]*\)\([^.0-9]\|$\)/\1.0\2/; s/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 10000 + \2 \* 100 + \3/')))
 
     test $verA -$2 $verB
 }
@@ -285,7 +285,7 @@ then
   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]*\.[0-9]*\.\)\([0-9]*\)\(.*\)/\2/')
+      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"

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]



Reply to: