mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Mohr <andi@lisas.de>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Randy Dunlap <rdunlap@xenotime.net>,
	Herbert Xu <herbert@gondor.hengli.com.au>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] Re: [PATCH] eradicate bashisms in scripts/patch-kernel
Date: Sun, 3 Apr 2011 20:58:28 +0200	[thread overview]
Message-ID: <20110403185828.GA4561@rhlx01.hs-esslingen.de> (raw)
In-Reply-To: <20071117205125.GA26425@rhlx01.hs-esslingen.de>

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

  parent reply	other threads:[~2011-04-03 18:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-31 21:13 [PATCH/RFC] " Andreas Mohr
2007-10-31 22:24 ` Randy Dunlap
2007-11-01 12:11   ` Andreas Mohr
2007-11-01 15:24     ` Randy Dunlap
2007-11-01 22:16       ` Andreas Mohr
2007-11-01 23:08         ` Randy Dunlap
2007-11-02  2:01           ` Herbert Xu
2007-11-02 20:09             ` Andreas Mohr
2007-11-02 20:17               ` Randy Dunlap
2007-11-05 19:58                 ` Andreas Mohr
2007-11-14 22:46                   ` Randy Dunlap
2007-11-17 16:33                     ` Andreas Mohr
2007-11-17 16:43                       ` Herbert Xu
2007-11-17 17:28                       ` Sam Ravnborg
2007-11-17 20:51                         ` [PATCH] " Andreas Mohr
2008-01-02 23:00                           ` Randy Dunlap
2011-04-03 18:58                           ` Andreas Mohr [this message]
2011-04-03 19:40                             ` [PATCH] " Randy Dunlap
2011-04-21 11:36                               ` Andreas Mohr
2011-04-04 12:59                             ` Michal Marek
2007-11-17 17:24 ` [PATCH/RFC] " Adrian Bunk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110403185828.GA4561@rhlx01.hs-esslingen.de \
    --to=andi@lisas.de \
    --cc=akpm@linux-foundation.org \
    --cc=herbert@gondor.hengli.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®