lkml.org 
[lkml]   [2015]   [Jan]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] scripts: fix link-vmlinux.sh bash-ism
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


\
 
 \ /
  Last update: 2015-01-02 17:01    [W:0.069 / U:1.796 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site