]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
kbuild: dummy-tools: avoid tmpdir leak in dummy gcc
authorOndrej Mosnacek <omosnace@redhat.com>
Mon, 11 Jul 2022 12:09:23 +0000 (14:09 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:38:01 +0000 (11:38 +0200)
commit aac289653fa5adf9e9985e4912c1d24a3e8cbab2 upstream.

When passed -print-file-name=plugin, the dummy gcc script creates a
temporary directory that is never cleaned up. To avoid cluttering
$TMPDIR, instead use a static directory included in the source tree.

Fixes: 76426e238834 ("kbuild: add dummy toolchains to enable all cc-option etc. in Kconfig")
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
scripts/dummy-tools/gcc

index 0d0589cf8184ede9d76d2165ae209eea5a145ac0..346757a87dbc888f6df7654c2070d928642c1c73 100755 (executable)
@@ -77,12 +77,8 @@ fi
 
 # To set GCC_PLUGINS
 if arg_contain -print-file-name=plugin "$@"; then
-       plugin_dir=$(mktemp -d)
-
-       mkdir -p $plugin_dir/include
-       touch $plugin_dir/include/plugin-version.h
-
-       echo $plugin_dir
+       # Use $0 to find the in-tree dummy directory
+       echo "$(dirname "$(readlink -f "$0")")/dummy-plugin-dir"
        exit 0
 fi