2008-11-12 19:06:07

by Werner Almesberger

[permalink] [raw]
Subject: [PATCH] remove bashisms from scripts/extract-ikconfig

unbashify-extract-ikconfig.patch

scripts/extract-ikconfig contains a lot of gratuituous bashisms,
which make it fail if /bin/sh isn't bash. This patch replaces them
with regular Bourne shell constructs.

Signed-off-by: Werner Almesberger <[email protected]>

---

diff --git a/scripts/extract-ikconfig b/scripts/extract-ikconfig
index 8187e6f..72997c3 100755
--- a/scripts/extract-ikconfig
+++ b/scripts/extract-ikconfig
@@ -8,8 +8,8 @@ test -e $binoffset || cc -o $binoffset ./scripts/binoffset.c || exit 1

IKCFG_ST="0x49 0x4b 0x43 0x46 0x47 0x5f 0x53 0x54"
IKCFG_ED="0x49 0x4b 0x43 0x46 0x47 0x5f 0x45 0x44"
-function dump_config {
- typeset file="$1"
+dump_config() {
+ file="$1"

start=`$binoffset $file $IKCFG_ST 2>/dev/null`
[ "$?" != "0" ] && start="-1"
@@ -18,8 +18,8 @@ function dump_config {
fi
end=`$binoffset $file $IKCFG_ED 2>/dev/null`

- let start="$start + 8"
- let size="$end - $start"
+ start=`expr $start + 8`
+ size=`expr $end - $start`

dd if="$file" ibs=1 skip="$start" count="$size" 2>/dev/null | zcat


2008-11-12 19:14:56

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] remove bashisms from scripts/extract-ikconfig

Werner Almesberger wrote:
> unbashify-extract-ikconfig.patch
>
> scripts/extract-ikconfig contains a lot of gratuituous bashisms,
> which make it fail if /bin/sh isn't bash. This patch replaces them
> with regular Bourne shell constructs.
>
> Signed-off-by: Werner Almesberger <[email protected]>

Acked-by: Randy Dunlap <[email protected]> # as file author


> ---
>
> diff --git a/scripts/extract-ikconfig b/scripts/extract-ikconfig
> index 8187e6f..72997c3 100755
> --- a/scripts/extract-ikconfig
> +++ b/scripts/extract-ikconfig
> @@ -8,8 +8,8 @@ test -e $binoffset || cc -o $binoffset ./scripts/binoffset.c || exit 1
>
> IKCFG_ST="0x49 0x4b 0x43 0x46 0x47 0x5f 0x53 0x54"
> IKCFG_ED="0x49 0x4b 0x43 0x46 0x47 0x5f 0x45 0x44"
> -function dump_config {
> - typeset file="$1"
> +dump_config() {
> + file="$1"
>
> start=`$binoffset $file $IKCFG_ST 2>/dev/null`
> [ "$?" != "0" ] && start="-1"
> @@ -18,8 +18,8 @@ function dump_config {
> fi
> end=`$binoffset $file $IKCFG_ED 2>/dev/null`
>
> - let start="$start + 8"
> - let size="$end - $start"
> + start=`expr $start + 8`
> + size=`expr $end - $start`
>
> dd if="$file" ibs=1 skip="$start" count="$size" 2>/dev/null | zcat
>
> --


--
~Randy

2008-11-22 11:25:28

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH] remove bashisms from scripts/extract-ikconfig

On Wed, Nov 12, 2008 at 04:39:35PM -0200, Werner Almesberger wrote:
> unbashify-extract-ikconfig.patch
>
> scripts/extract-ikconfig contains a lot of gratuituous bashisms,
> which make it fail if /bin/sh isn't bash. This patch replaces them
> with regular Bourne shell constructs.
>
> Signed-off-by: Werner Almesberger <[email protected]>

Applied to kbuild-next with Randy's ack.

Sam