kbuild: set EXIT trap before creating temporary directory
authorMasahiro Yamada <masahiroy@kernel.org>
Thu, 28 Jul 2022 03:14:33 +0000 (12:14 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Wed, 3 Aug 2022 13:56:38 +0000 (22:56 +0900)
commitdd29865633a5535889568b5f38f74a445c227e5d
treebc9c00770da51637468122ca5b621d5626a35951
parent7193cda917ffbf5a473cbf3d26ba6787b6b02a84
kbuild: set EXIT trap before creating temporary directory

Swap the order of 'mkdir' and 'trap' just in case the subshell is
interrupted between 'mkdir' and 'trap' although the effect might be
subtle.

This does not intend to make the cleanup perfect. There are more cases
that miss to remove the tmp directory, for example:

 - When interrupted, dash does not invoke the EXIT trap (bash does)

 - 'rm' command might be interrupted before removing the directory

I am not addressing all the cases since the tmp directory is harmless
after all.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
scripts/Kconfig.include
scripts/Makefile.compiler