[PATCH v2] scripts: fix link-vmlinux.sh bash-ism
From: sylvain . bertrand
Date: Wed May 06 2015 - 20:36:18 EST
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
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Signed-off-by: Sylvain BERTRAND <sylvain.bertrand@xxxxxxxxx>
---
--- a/scripts/link-vmlinux.sh 2014-12-29 15:10:29.436431249 +0000
+++ b/scripts/link-vmlinux.sh 2014-12-29 16:23:06.010853608 +0000
@@ -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
--
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/