2014-12-29 16:35:02

by Sylvain BERTRAND

[permalink] [raw]
Subject: [PATCH] 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

Cc: Ingo Molnar <[email protected]>
Signed-off-by: Sylvain BERTRAND <[email protected]>
---
--- 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


2015-04-27 15:25:42

by Sylvain BERTRAND

[permalink] [raw]
Subject: Re: [PATCH] scripts: fix link-vmlinux.sh bash-ism

On Tue, Mar 17, 2015 at 09:59:13PM +0100, Michal Marek wrote:
> 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

--
Sylvain

2015-05-06 13:54:31

by Sylvain BERTRAND

[permalink] [raw]
Subject: Re: [PATCH] scripts: fix link-vmlinux.sh bash-ism

On Mon, Apr 27, 2015 at 03:25:25PM +0000, [email protected] wrote:
> On Tue, Mar 17, 2015 at 09:59:13PM +0100, Michal Marek wrote:
> > 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,

--
Sylvain

2015-05-06 14:25:32

by Michal Marek

[permalink] [raw]
Subject: Re: [PATCH] scripts: fix link-vmlinux.sh bash-ism

On 2015-05-06 15:54, [email protected] wrote:
> On Mon, Apr 27, 2015 at 03:25:25PM +0000, [email protected] wrote:
>> On Tue, Mar 17, 2015 at 09:59:13PM +0100, Michal Marek wrote:
>>> 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?

Please post a v2 with a complete changelog.

Michal

2015-05-07 00:36:15

by Sylvain BERTRAND

[permalink] [raw]
Subject: [PATCH v2] 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

Cc: Ingo Molnar <[email protected]>
Signed-off-by: Sylvain BERTRAND <[email protected]>
---
--- 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

2015-05-07 11:59:03

by Michal Marek

[permalink] [raw]
Subject: Re: [PATCH v2] scripts: fix link-vmlinux.sh bash-ism

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 1
>
> See the following document for behavior of posix shell trap instruction:
> http://pubs.opengroup.org/onlinepubs/000095399/utilities/trap.html
>
> Cc: Ingo Molnar <[email protected]>
> Signed-off-by: Sylvain BERTRAND <[email protected]>

Applied to kbuild.git#kbuild now, thanks.

Michal