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

Bug#642031: debootstrap: Debootstrap error when host and build have different kernels



Milo Mak wrote:
> debian live-helper # chroot /data/ext/live-helper/chroot
> root@debian:/# dpkg --force-depends --install
> /var/cache/apt/archives/libc6_2.11.2-10_amd64.deb
> (Reading database ... 349 files and directories currently installed.)
> Unpacking libc6 (from .../libc6_2.11.2-10_amd64.deb) ...
> [: 392: Illegal number: 3.0-3.dmz.2-liquorix-amd64
> /var/lib/dpkg/tmp.ci/preinst: 392: arithmetic expression: expecting EOF:
> "3.0-3.dmz.2-liquorix-amd64"
> dpkg: error processing /var/cache/apt/archives/libc6_2.11.2-10_amd64.deb
> (--install):

This code from the libc6 2.11.2-10 preinst is broken when presented 
with a kernel version with only two numbers, like "3.0-foo". One of
likely many reasons that Debian versions the kernel 3.0.0-foo.

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/')))

    test $verA -$2 $verB
}

It's fixed already in the version in unstable. (Although it's amusing
to note this code in turn falls over if Linus decides a better kernel
version is "4-foo".)

linux_compare_versions () {
    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
}

I'm unsure about trying to work around this in debootstrap, despite 
https://bugs.launchpad.net/ubuntu/+source/debootstrap/+bug/802985 having
a LD_PRELOAD hack to do so.

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature


Reply to: