lkml.org 
[lkml]   [2011]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Re: [PATCH] eradicate bashisms in scripts/patch-kernel
Silence a remaining annoying (or worse, irritating - "is my entire patched tree
broken now!?") bashism-related message that occurs when /bin/sh is configured
to instead deploy dash, a POSIX-compliant shell, as is the pretty much
standard case on e.g. Debian.

# linux-2.6.38.patch-kernel_test/scripts/patch-kernel linux-2.6.38.patch-kernel_test patch-2.6
Current kernel version is 2.6.38 ( Flesh-Eating Bats with Fangs)
===> linux-2.6.38.patch-kernel_test/scripts/patch-kernel: line 253: [: =: unary operator expected <===
cannot find patch file: patch-2.6.39
---

Debug log of uncorrected script:

# sh -x linux-2.6.38.patch-kernel_test/scripts/patch-kernel linux-2.6.38.patch-kernel_test patch-2.6
+ PNAME=patch-kernel
+ sourcedir=linux-2.6.38.patch-kernel_test
+ patchdir=patch-2.6
+ stopvers=default
+ '[' linux-2.6.38.patch-kernel_test = -h -o linux-2.6.38.patch-kernel_test = --help -o '!' -r linux-2.6.38.patch-kernel_test/Makefile ']'
+ for PARM in '$*'
+ case $PARM in
+ for PARM in '$*'
+ case $PARM in
++ mktemp ./.tmpver.XXXXXX
+ TMPFILE=./.tmpver.2Yv11Y
+ grep -E '^(VERSION|PATCHLEVEL|SUBLEVEL|EXTRAVERSION)' linux-2.6.38.patch-kernel_test/Makefile
+ tr -d '[:blank:]'
+ . ./.tmpver.2Yv11Y.1
++ VERSION=2
++ PATCHLEVEL=6
++ SUBLEVEL=38
++ EXTRAVERSION=
+ rm -f ./.tmpver.2Yv11Y ./.tmpver.2Yv11Y.1
+ '[' -z 2 -o -z 6 -o -z 38 ']'
++ grep '^NAME' linux-2.6.38.patch-kernel_test/Makefile
+ NAME='NAME = Flesh-Eating Bats with Fangs'
+ NAME=' Flesh-Eating Bats with Fangs'
+ echo 'Current kernel version is 2.6.38 ( Flesh-Eating Bats with Fangs)'
Current kernel version is 2.6.38 ( Flesh-Eating Bats with Fangs)
+ EXTRAVER=
+ '[' x '!=' x ']'
+ '[' default '!=' default ']'
+ STOPSUBLEVEL=9999
+ STOPEXTRA=9999
+ '[' 9999 -lt 38 ']'
+ '[' x '!=' x ']'
+ CURRENTFULLVERSION=2.6.38
+ '[' x '!=' x ']'
+ '[' 9999 -gt 38 ']'
+ :
+ CURRENTFULLVERSION=2.6.38
+ EXTRAVER=
+ '[' = 2.6.38 ']'
linux-2.6.38.patch-kernel_test/scripts/patch-kernel: line 253: [: =: unary operator expected
+ SUBLEVEL=39
+ FULLVERSION=2.6.39
+ '[' 39 -gt 9999 ']'
+ patch=patch-2.6.39
+ findFile patch-2.6/patch-2.6.39
+ filebase=patch-2.6/patch-2.6.39
+ '[' -r patch-2.6/patch-2.6.39.gz ']'
+ '[' -r patch-2.6/patch-2.6.39.bz ']'
+ '[' -r patch-2.6/patch-2.6.39.bz2 ']'
+ '[' -r patch-2.6/patch-2.6.39.zip ']'
+ '[' -r patch-2.6/patch-2.6.39.Z ']'
+ '[' -r patch-2.6/patch-2.6.39 ']'
+ return 1
+ noFile patch-2.6.39
+ echo 'cannot find patch file: patch-2.6.39'
cannot find patch file: patch-2.6.39
+ exit 1




Debug log of patched script (condensed to relevant parts):

+ STOPSUBLEVEL=9999
+ STOPEXTRA=9999
+ '[' 9999 -lt 38 ']'
+ '[' x '!=' x ']'
+ CURRENTFULLVERSION=2.6.38
+ '[' x '!=' x ']'
+ '[' 9999 -gt 38 ']'
+ :
+ CURRENTFULLVERSION=2.6.38
+ EXTRAVER=
+ '[' x = x2.6.38 ']'
+ SUBLEVEL=39
+ FULLVERSION=2.6.39


Since my last patch (the parent mail) happened to modify the very same line,
I'm slightly wondering why last time it didn't exhibit this issue
(IIRC this occurred for the first time a couple months later,
perhaps in newer shell versions).

Patch has been created on git 2.6.39-rc1,
run through checkpatch.pl,
tested to work on dash and still work on bash,
and tested to apply cleanly to 2.6.37, too.

IMHO this is a low-priority item,
certainly not requiring service within current -rc handling,
and neither at -stable (I assume that only point versions
could make good use of this patch anyway).
IOW standard patch circulation.
I'm assuming that Sam would be the one to queue it up,
just like last time.

Thanks!

Signed-off-by: Andreas Mohr <andi@lisas.de>


diff --git a/scripts/patch-kernel b/scripts/patch-kernel
index 46a59ca..20fb25c 100755
--- a/scripts/patch-kernel
+++ b/scripts/patch-kernel
@@ -250,7 +250,7 @@ while : # incrementing SUBLEVEL (s in v.p.s)
do
CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
EXTRAVER=
- if [ $STOPFULLVERSION = $CURRENTFULLVERSION ]; then
+ if [ x$STOPFULLVERSION = x$CURRENTFULLVERSION ]; then
echo "Stopping at $CURRENTFULLVERSION base as requested."
break
fi

\
 
 \ /
  Last update: 2011-04-03 21:01    [W:0.075 / U:0.604 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site