[PATCH] gen_build_files.sh: Remove bashisms

Peter Tyser ptyser at xes-inc.com
Thu May 13 23:05:53 UTC 2010


Using 'read' without a variable is not supported in many shells.  Lines
such as 'while read; do' in gen_build_files.sh would result in build
failures when using sh or dash as an interpreter:
$ make defconfig
read: 53: arg count
scripts/kconfig/conf -d Config.in
Config.in:727: can't open file "findutils/Config.in"
make[1]: *** [defconfig] Error 1
make: *** [defconfig] Error 2

Signed-off-by: Peter Tyser <ptyser at xes-inc.com>
---
 scripts/gen_build_files.sh |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh
index 2baefa2..b461557 100755
--- a/scripts/gen_build_files.sh
+++ b/scripts/gen_build_files.sh
@@ -7,9 +7,7 @@ cd -- "$2" || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; }
 
 srctree="$1"
 
-find -type d | while read; do
-	d="$REPLY"
-
+find -type d | while read d; do
 	src="$srctree/$d/Kbuild.src"
 	dst="$d/Kbuild"
 	if test -f "$src"; then
@@ -17,9 +15,9 @@ find -type d | while read; do
 
 		s=`sed -n 's@^//kbuild:@@p' -- "$srctree/$d"/*.c`
 		echo "# DO NOT EDIT. This file is generated from Kbuild.src" >"$dst.$$.tmp"
-		while read; do
-			test x"$REPLY" = x"INSERT" && REPLY="$s"
-			printf "%s\n" "$REPLY"
+		while read line; do
+			test x"$line" = x"INSERT" && line="$s"
+			printf "%s\n" "$line"
 		done <"$src" >>"$dst.$$.tmp"
 
 		if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then
@@ -37,9 +35,9 @@ find -type d | while read; do
 
 		s=`sed -n 's@^//config:@@p' -- "$srctree/$d"/*.c`
 		echo "# DO NOT EDIT. This file is generated from Config.src" >"$dst.$$.tmp"
-		while read; do
-			test x"$REPLY" = x"INSERT" && REPLY="$s"
-			printf "%s\n" "$REPLY"
+		while read line; do
+			test x"$line" = x"INSERT" && line="$s"
+			printf "%s\n" "$line"
 		done <"$src" >>"$dst.$$.tmp"
 
 		if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then
-- 
1.6.2.1



More information about the busybox mailing list