Re: [PATCH/RFC] eradicate bashisms in scripts/patch-kernel

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andreas Mohr
Date: Thursday, November 1, 2007 - 5:11 am

On Wed, Oct 31, 2007 at 03:24:22PM -0700, Randy Dunlap wrote:

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"".


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.


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.


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.


No. I should have started by looking at the opengroup.org site when
looking for POSIX specs...


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)

Thanks for your very fast review,

Andreas Mohr
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH/RFC] eradicate bashisms in scripts/patch-kernel, Andreas Mohr, (Wed Oct 31, 2:13 pm)
Re: [PATCH/RFC] eradicate bashisms in scripts/patch-kernel, Andreas Mohr, (Thu Nov 1, 5:11 am)
[PATCH] eradicate bashisms in scripts/patch-kernel, Andreas Mohr, (Sat Nov 17, 1:51 pm)
Re: [PATCH] eradicate bashisms in scripts/patch-kernel, Randy Dunlap, (Wed Jan 2, 4:00 pm)