linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scripts: fix link-vmlinux.sh bash-ism
@ 2014-12-29 16:34 Sylvain BERTRAND
  2015-01-02 15:55 ` Michal Marek
  0 siblings, 1 reply; 9+ messages in thread
From: Sylvain BERTRAND @ 2014-12-29 16:34 UTC (permalink / raw)
  To: linux-kbuild; +Cc: linux-kernel, mingo

Chocked while compiling linux with dash shell instead of bash shell.
See:
http://pubs.opengroup.org/onlinepubs/000095399/utilities/trap.html

Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sylvain BERTRAND <sylvain.bertrand@gmail.com>
---
--- 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] scripts: fix link-vmlinux.sh bash-ism
  2014-12-29 16:34 [PATCH] scripts: fix link-vmlinux.sh bash-ism Sylvain BERTRAND
@ 2015-01-02 15:55 ` Michal Marek
  2015-03-03 16:34   ` Sylvain BERTRAND
  0 siblings, 1 reply; 9+ messages in thread
From: Michal Marek @ 2015-01-02 15:55 UTC (permalink / raw)
  To: Sylvain BERTRAND, linux-kbuild; +Cc: linux-kernel, mingo

On 2014-12-29 17:34, Sylvain BERTRAND wrote:
> 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?


> Cc: Ingo Molnar <mingo@kernel.org>
> Signed-off-by: Sylvain BERTRAND <sylvain.bertrand@gmail.com>
> ---
> --- 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

Why not use 'cleanup' directly as a handler?

Michal

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] scripts: fix link-vmlinux.sh bash-ism
  2015-01-02 15:55 ` Michal Marek
@ 2015-03-03 16:34   ` Sylvain BERTRAND
  2015-03-17 20:59     ` Michal Marek
  0 siblings, 1 reply; 9+ messages in thread
From: Sylvain BERTRAND @ 2015-03-03 16:34 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel

On Fri, Jan 02, 2015 at 04:55:42PM +0100, Michal Marek wrote:
> On 2014-12-29 17:34, Sylvain BERTRAND wrote:
> > 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?

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?

-- 
Sylvain

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] scripts: fix link-vmlinux.sh bash-ism
  2015-03-03 16:34   ` Sylvain BERTRAND
@ 2015-03-17 20:59     ` Michal Marek
  2015-04-27 15:25       ` sylvain.bertrand
  0 siblings, 1 reply; 9+ messages in thread
From: Michal Marek @ 2015-03-17 20:59 UTC (permalink / raw)
  To: Sylvain BERTRAND; +Cc: linux-kbuild, linux-kernel

Dne 3.3.2015 v 17:34 Sylvain BERTRAND napsal(a):
> On Fri, Jan 02, 2015 at 04:55:42PM +0100, Michal Marek wrote:
>> On 2014-12-29 17:34, Sylvain BERTRAND wrote:
>>> 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?
> 
> 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?

Sorry if I wasn't clear. The changelog should contain the actual error
message or description of wrong behavior when ran under dash.

Michal

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] scripts: fix link-vmlinux.sh bash-ism
  2015-03-17 20:59     ` Michal Marek
@ 2015-04-27 15:25       ` sylvain.bertrand
  2015-05-06 13:54         ` sylvain.bertrand
  0 siblings, 1 reply; 9+ messages in thread
From: sylvain.bertrand @ 2015-04-27 15:25 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] scripts: fix link-vmlinux.sh bash-ism
  2015-04-27 15:25       ` sylvain.bertrand
@ 2015-05-06 13:54         ` sylvain.bertrand
  2015-05-06 14:25           ` Michal Marek
  0 siblings, 1 reply; 9+ messages in thread
From: sylvain.bertrand @ 2015-05-06 13:54 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel

On Mon, Apr 27, 2015 at 03:25:25PM +0000, sylvain.bertrand@gmail.com 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] scripts: fix link-vmlinux.sh bash-ism
  2015-05-06 13:54         ` sylvain.bertrand
@ 2015-05-06 14:25           ` Michal Marek
  2015-05-07  0:36             ` [PATCH v2] " sylvain.bertrand
  0 siblings, 1 reply; 9+ messages in thread
From: Michal Marek @ 2015-05-06 14:25 UTC (permalink / raw)
  To: sylvain.bertrand; +Cc: linux-kbuild, linux-kernel

On 2015-05-06 15:54, sylvain.bertrand@gmail.com wrote:
> On Mon, Apr 27, 2015 at 03:25:25PM +0000, sylvain.bertrand@gmail.com 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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] scripts: fix link-vmlinux.sh bash-ism
  2015-05-06 14:25           ` Michal Marek
@ 2015-05-07  0:36             ` sylvain.bertrand
  2015-05-07 11:58               ` Michal Marek
  0 siblings, 1 reply; 9+ messages in thread
From: sylvain.bertrand @ 2015-05-07  0:36 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel

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@kernel.org>
Signed-off-by: Sylvain BERTRAND <sylvain.bertrand@gmail.com>
---
--- 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] scripts: fix link-vmlinux.sh bash-ism
  2015-05-07  0:36             ` [PATCH v2] " sylvain.bertrand
@ 2015-05-07 11:58               ` Michal Marek
  0 siblings, 0 replies; 9+ messages in thread
From: Michal Marek @ 2015-05-07 11:58 UTC (permalink / raw)
  To: sylvain.bertrand; +Cc: linux-kbuild, linux-kernel

On 2015-05-07 02:36, sylvain.bertrand@gmail.com 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 <mingo@kernel.org>
> Signed-off-by: Sylvain BERTRAND <sylvain.bertrand@gmail.com>

Applied to kbuild.git#kbuild now, thanks.

Michal


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-05-07 11:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-29 16:34 [PATCH] scripts: fix link-vmlinux.sh bash-ism Sylvain BERTRAND
2015-01-02 15:55 ` Michal Marek
2015-03-03 16:34   ` Sylvain BERTRAND
2015-03-17 20:59     ` Michal Marek
2015-04-27 15:25       ` sylvain.bertrand
2015-05-06 13:54         ` sylvain.bertrand
2015-05-06 14:25           ` Michal Marek
2015-05-07  0:36             ` [PATCH v2] " sylvain.bertrand
2015-05-07 11:58               ` Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).