scripts: fix link-vmlinux.sh bash-ism
PATCH 1/1 scripts: fix link-vmlinux.sh bash-ism
Chocked while compiling linux with dash shell instead of bash shell. See:
http://pubs.opengroup.org/onlinepubs/000095399/utilities/trap.html
---
scripts/link-vmlinux.sh +14 -2
@@ -111,7 +111,6 @@ } # Delete output files in case of error -trap cleanup SIGHUP SIGINT SIGQUIT SIGTERM ERR cleanup() { rm -f .old_version
@@ -124,6 +123,20 @@ rm -f vmlinux.o } +on_exit() +{ + if [ $? -ne 0 ]; then + cleanup + fi +} +trap on_exit EXIT + +on_signals() +{ + exit 1 +} +trap on_signals HUP INT QUIT TERM + # # # Use "make V=1" to debug this script
@@ -231,7 +244,6 @@ if ! cmp -s System.map .tmp_System.map; then echo >&2 Inconsistent kallsyms data echo >&2 Try "make KALLSYMS_EXTRA_PASS=1" as a workaround - cleanup exit 1 fi fi
Quoted 3 lines · Sylvain BERTRAND
Chocked while compiling linux with dash shell instead of bash shell. See:
http://pubs.opengroup.org/onlinepubs/000095399/utilities/trap.html
Please describe the actual problem in the changelog. I guess it's because of the 'ERR' trap?
Quoted 20 lines
Cc Ingo Molnar <[email protected]>Signed-off-by Sylvain BERTRAND <[email protected]>---
scripts/link-vmlinux.sh +3
-1@@ -111,7 +111,6 @@ } # Delete output files in case of error -trap cleanup SIGHUP SIGINT SIGQUIT SIGTERM ERR cleanup() { rm -f .old_version@@ -124,6 +123,20 @@ rm -f vmlinux.o } +on_exit() +{ + if [ $? -ne 0 ]; then
scripts/link-vmlinux.sh line 138
Quoted 10 lines
scripts/link-vmlinux.sh +10
-0+ cleanup + fi +} +trap on_exit EXIT + +on_signals() +{ + exit 1 +} +trap on_signals HUP INT QUIT TERM
Why not use 'cleanup' directly as a handler?
Michal
Quoted 7 lines · Michal Marek
Quoted 3 lines · Sylvain BERTRAND
Chocked while compiling linux with dash shell instead of bash shell. See:
http://pubs.opengroup.org/onlinepubs/000095399/utilities/trap.htmlPlease describe the actual problem in the changelog. I guess it's because of the 'ERR' trap?
Indeed:
- ERR is specific to bash
- signal names in a trap built-in instruction should be without the SIG prefix
Shall I repost a v2 with the above lines?
Signature · 1 line
Sylvain
Dne 3.3.2015 v 17:34 Sylvain BERTRAND napsal(a):
Quoted 6 lines · Michal Marek
Quoted 5 lines · Sylvain BERTRAND
Quoted 3 lines
Chocked while compiling linux with dash shell instead of bash shell. See:
http://pubs.opengroup.org/onlinepubs/000095399/utilities/trap.html
Quoted 8 lines
Quoted 2 lines
Please describe the actual problem in the changelog. I guess it's because of the 'ERR' trap?
Indeed:
- ERR is specific to bash
- signal names in a trap built-in instruction should be without the SIG prefixShall I repost a v2 with the above lines?
Sorry if I wasn't clear. The changelog should contain the actual error message or description of wrong behavior when ran under dash.
Michal
Quoted 2 lines · Michal Marek
Sorry if I wasn't clear. The changelog should contain the actual error message or description of wrong behavior when ran under dash.
While building linux with dash shell:
LINK vmlinux
trap: SIGHUP: bad trap
/src/linux-4.0/Makefile:933: recipe for target 'vmlinux' failed make[1]: *** [vmlinux] Error 1
Signature · 1 line
Sylvain
Quoted 9 lines · On Mon, Apr 27, 2015 at 03:25:25PM +0000, [email protected] wrote:
Quoted 2 lines · Michal Marek
Sorry if I wasn't clear. The changelog should contain the actual error message or description of wrong behavior when ran under dash.
While building linux with dash shell:
LINK vmlinux
trap: SIGHUP: bad trap
/src/linux-4.0/Makefile:933: recipe for target 'vmlinux' failed make[1]: *** [vmlinux] Error 1
Hi, what's up with this?
regards,
Signature · 1 line
Sylvain
Quoted 5 lines · On 2015-05-06 15:54, [email protected] wrote:
Quoted 4 lines · On Mon, Apr 27, 2015 at 03:25:25PM +0000, [email protected] wrote:
Quoted 2 lines · Michal Marek
Sorry if I wasn't clear. The changelog should contain the actual error message or description of wrong behavior when ran under dash.
Quoted 7 lines
Quoted 5 lines
While building linux with dash shell:
LINK vmlinux
trap: SIGHUP: bad trap
/src/linux-4.0/Makefile:933: recipe for target 'vmlinux' failed make[1]: *** [vmlinux] Error 1Hi, what's up with this?
Please post a v2 with a complete changelog.
Michal
PATCH v2 1/1 scripts: fix link-vmlinux.sh bash-ism
While building linux with dash shell:
LINK vmlinux
trap: SIGHUP: bad trap
/src/linux-4.0/Makefile:933: recipe for target 'vmlinux' failed make[1]: *** [vmlinux] Error 1
See the following document for behavior of posix shell trap instruction:
http://pubs.opengroup.org/onlinepubs/000095399/utilities/trap.html
---
scripts/link-vmlinux.sh +14 -2
@@ -111,7 +111,6 @@ } # Delete output files in case of error -trap cleanup SIGHUP SIGINT SIGQUIT SIGTERM ERR cleanup() { rm -f .old_version
@@ -124,6 +123,20 @@ rm -f vmlinux.o } +on_exit() +{ + if [ $? -ne 0 ]; then + cleanup + fi +} +trap on_exit EXIT + +on_signals() +{ + exit 1 +} +trap on_signals HUP INT QUIT TERM + # # # Use "make V=1" to debug this script
@@ -231,7 +244,6 @@ if ! cmp -s System.map .tmp_System.map; then echo >&2 Inconsistent kallsyms data echo >&2 Try "make KALLSYMS_EXTRA_PASS=1" as a workaround - cleanup exit 1 fi fi
Quoted 11 lines · On 2015-05-07 02:36, [email protected] wrote:
While building linux with dash shell:
LINK vmlinux
trap: SIGHUP: bad trap
/src/linux-4.0/Makefile:933: recipe for target 'vmlinux' failed make[1]: *** [vmlinux] Error 1See the following document for behavior of posix shell trap instruction:
http://pubs.opengroup.org/onlinepubs/000095399/utilities/trap.htmlCc Ingo Molnar <[email protected]>Signed-off-by Sylvain BERTRAND <[email protected]>
Applied to kbuild.git#kbuild now, thanks.
Michal