Re: [PATCH] Remove bashisms from scripts/extract-ikconfig
From: Willy Tarreau
Date: Sat Jun 09 2007 - 15:53:49 EST
On Sat, Jun 09, 2007 at 09:34:36PM +0200, Christian Kujau wrote:
> On Sat, 9 Jun 2007, Julio M. Merino Vidal wrote:
> >Wouldn't this be better expressed as:
> >
> > start=$(($start + 8))
> > size=$(($end - $start))
> >
> >to avoid invoking a subshell?
>
> This is certainly possible for lots for scripts, but was not the "scope"
> of this patch. ` is not bash-specific and does not break anything.
That's wrong. It will now require "expr" to be present and working on
the machine, eventhough it's certainly needed for other parts of the
kernel. Also, the remaining function will be considerably slower than
what it initially was. If it's called very frequently, it can be a
problem.
I agree with Julio that if you want to fix the code for its bashism,
you should not change its behaviour and stay as much as possible close
to what it initially did.
Also, beware that the "typeset file=y" did another thing : declare "file"
as local to the function. With your change, any global variable called
"file" will have its content wiped after a call to this function. You
should ensure that it is not used anywhere else, or better, change its
name for something less common than "file".
Regards,
Willy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/