Bug#241395: libc6: preinst fails for kernel 2.4.23dual
GOTO Masanori <gotom@debian.or.jp> writes:
> At Thu, 01 Apr 2004 07:10:50 +0200,
> Goswin Brederlow wrote:
> > running cdebootstrap I see the following error:
> >
> > O: /var/lib/dpkg/tmp.ci/preinst: line 184: [: 23dual: integer expression expected
> >...
> >
> > % uname -r
> > 2.4.23dual
>
> You didn't use make-kpkg?
I think I did but messed up the append, should have been "-dual" or
something.
> > I have seen no ill effects from this in month so I guess glibc does a
> > scanf and gets 23 as revision number or I'm just plain lucky. Maybe I
> > should have used 2.4.23-dual but I didn't and glibc should cope with
> > that.
> >
> > I guess the 'if [ "$kernel_rev" -ge 255 ]' should be true in this case
> > too, i.e. display the warning and exit 1, but giving an error on [ is
> > startling (Thats what I mean with cope. Doesn't have to work, just
> > give a helpfull message).
>
> There are various ways to fix this situation, one example:
>
> kernel_rev=$(uname -r | awk -F '[.-]' '{print $3}' | sed 's/\([[:digit:]]*\).*/\1/' )
kernel_rev=$(uname -r | sed 's/\([0-9]*\.[0-9]*\.\)\([0-9]*\)\(.*\)/\2/')
Please don't use awk (see BTS for related bugs). awk requires a
Pre-Depends since its an alternative and mawk (provides awk) is not
even essential.
sed on the other hand is essential.
> Could someone who is shell script god suggest us the nice way to fix
> it?
>
> Regards,
> -- gotom
Some test versions:
sh-2.05b$ echo -e "2.4.23\n2.4.23-1\n2.4.23-foo\n2.4.23foo\n2.4.2342" | sed 's/\([0-9]*\.[0-9]*\.\)\([0-9]*\)\(.*\)/\2/'
23
23
23
23
2342
MfG
Goswin
Reply to: