In the dd-wrt community build project we noticed some errors buried for years 
in the huge build log and traced them back to a malformed line in a busybox 
.config file (our fault). The existing busybox scripts' error checking will 
only get triggered if the malformed line is the last one executed in the 
.config being sourced.

The bad line (see below) passed the gnu make syntax checking but unknowingly 
failed /bin/sh syntax checking. 

CONFIG_PREFIX="$(PREFIX)"

Here's a possible way to trigger errors no matter on which line the error 
occurs. Note that the trylink script sources the .config file twice but the 
below patch only sets the "exit immediately" option during one of those times. 
In our case, one fatal error is enough to notice the bad .config file. Just 
noticed trylink does not have "|| exit 1" after sourcing so perhaps a 
missing/invalid .config is acceptable in that case and shouldn't be patched? I 
know nothing about busybox build scripts...

Have been a fan of busybox for years. Congrats on a cool product!

diff --git a/scripts/embedded_scripts b/scripts/embedded_scripts
index aa7bf3e8a..bb060e787 100755
--- a/scripts/embedded_scripts
+++ b/scripts/embedded_scripts
@@ -1,6 +1,8 @@
 #!/bin/sh
 
+set -e
 . ./.config || exit 1
+set +e
 
 target="$1"
 custom_loc="$2"
diff --git a/scripts/generate_BUFSIZ.sh b/scripts/generate_BUFSIZ.sh
index 718788e0b..dedf8e74e 100755
--- a/scripts/generate_BUFSIZ.sh
+++ b/scripts/generate_BUFSIZ.sh
@@ -3,7 +3,9 @@
 #
 # scripts/generate_BUFSIZ.sh include/common_bufsiz.h
 
+set -e
 . ./.config || exit 1
+set +e
 
 debug=false
 #debug=true
diff --git a/scripts/trylink b/scripts/trylink
index 6b74f092d..bf3f44d33 100755
--- a/scripts/trylink
+++ b/scripts/trylink
@@ -228,7 +228,9 @@ else
     }
 fi
 
+set -e
 . ./.config
+set +e
 
 sharedlib_dir="0_lib"
 
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to