From: Randy Dunlap <randy.dunlap@oracle.com>
To: Andreas Mohr <andi@lisas.de>
Cc: Andrew Morton <akpm@osdl.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH/RFC] eradicate bashisms in scripts/patch-kernel
Date: Thu, 1 Nov 2007 08:24:57 -0700 [thread overview]
Message-ID: <20071101082457.ff9a5d67.randy.dunlap@oracle.com> (raw)
In-Reply-To: <20071101121133.GA14807@rhlx01.hs-esslingen.de>
On Thu, 1 Nov 2007 13:11:33 +0100 Andreas Mohr wrote:
> On Wed, Oct 31, 2007 at 03:24:22PM -0700, Randy Dunlap wrote:
> > Andreas Mohr wrote:
> > >- the "source" statement most likely needs the ./ prepended, as can be
> > >gathered from e.g. http://osdir.com/ml/colinux.devel/2005-12/msg00036.html
> >
> > That email isn't very convincing to me.
>
> Actually that place simply was where I found how the
>
> .: 188: .tmpver.eC4856.1: not found
>
> dash error that happened when I replaced the bash-specific "source"
> statement with its "." counterpart could be ""fixed"".
>
> > http://www.opengroup.org/onlinepubs/009695399/utilities/dot.html just says
> > that
> > if <filename> does not contain a slash, the search PATH shall be used
> > (searched).
> > If you want to prevent that, it's OK to use ./, but at least say that in the
> > patch description, please.
>
> So this part seems to indicate that merely prepending ./ is problematic,
> since ./ implies relative path resolution whereas $TMPFILE.1 could
> theoretically be an absolute path already.
> It would probably be best to add the ./ to mktemp already, to make sure
> we source *exactly* the filename expression we originally mktemp'd.
>
> OTOH prepending ./ to mktemp by default would deny mktemp any
> "search for a temporary-capable directory and create the file there"
> capabilities. Hmm. I should investigate POSIX shell sourcing
> mechanisms more.
As I indicated, I don't object to this part of the patch or to
the s/==/=/ part either. The ./ just needs better patch description.
> > >@@ -202,13 +202,7 @@
> > > EXTRAVER=
> > > if [ x$EXTRAVERSION != "x" ]
> > > then
> > >- if [ ${EXTRAVERSION:0:1} == "." ]; then
> > >- EXTRAVER=${EXTRAVERSION:1}
> > >- else
> > >- EXTRAVER=$EXTRAVERSION
> > >- fi
> > >- EXTRAVER=${EXTRAVER%%[[:punct:]]*}
> > >- #echo "$PNAME: changing EXTRAVERSION from $EXTRAVERSION to $EXTRAVER"
> >
> > What's the problem above?
>
> The variable manipulation seems bash-specific, the resulting dash error was:
>
> linux-2.6.23/scripts/patch-kernel: 205: Syntax error: Bad substitution
>
> which pointed at the
>
> if [ ${EXTRAVERSION:0:1} == "." ]; then
>
> line.
>
> > >
> > >- SUBLEVEL=$((SUBLEVEL + 1))
> > >+ SUBLEVEL=$(( $SUBLEVEL + 1 ))
> >
> > Why are the added spaces needed?
>
> They weren't strictly needed, what was needed was to add the missing $ sign
> (you could perhaps say that I added the spaces to emphasize the $ sign).
> Maybe they're best removed.
>
> > Did you look at
> > http://www.opengroup.org/onlinepubs/000095399/utilities/xcu_chap02.html ?
>
> No. I should have started by looking at the opengroup.org site when
> looking for POSIX specs...
>
> >
> > > FULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
> > > #echo "#___ trying $FULLVERSION ___"
> > >
> > >- if [ $((SUBLEVEL)) -gt $((STOPSUBLEVEL)) ]; then
> > >+ if [ $SUBLEVEL -gt $STOPSUBLEVEL ]; then
> >
> > What's the problem here?
>
> I got
>
> linux-2.6.23/scripts/patch-kernel: 270: arith: syntax error: "SUBLEVEL"
>
> thus I simply removed braces since that "fixed" the issue.
> May be incorrect, though...
>
>
> I'll think a bit more about these couple changed places (and whether
> this still truly works as intended) and mail a patch then.
>
> (and a big NOTE: I'm no POSIX vs. non-POSIX shell guru at all, only a
> semi-versed shell script writer, thus these changes should be reviewed
> quite thoroughly)
Neither am I. I read those web pages quickly yesterday, so after
you read them, we can discuss more and/or review more patches.
Thanks.
---
~Randy
next prev parent reply other threads:[~2007-11-01 15:26 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-31 21:13 [PATCH/RFC] eradicate bashisms in scripts/patch-kernel Andreas Mohr
2007-10-31 22:24 ` Randy Dunlap
2007-11-01 12:11 ` Andreas Mohr
2007-11-01 15:24 ` Randy Dunlap [this message]
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 ` [PATCH] " Andreas Mohr
2011-04-03 19:40 ` 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=20071101082457.ff9a5d67.randy.dunlap@oracle.com \
--to=randy.dunlap@oracle.com \
--cc=akpm@osdl.org \
--cc=andi@lisas.de \
--cc=linux-kernel@vger.kernel.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