All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kbuild: dummy-tools: avoid tmpdir leak in dummy gcc
@ 2022-07-11 12:09 Ondrej Mosnacek
  2022-07-12  3:20 ` Masahiro Yamada
  0 siblings, 1 reply; 2+ messages in thread
From: Ondrej Mosnacek @ 2022-07-11 12:09 UTC (permalink / raw)
  To: Masahiro Yamada, Michal Marek, Nick Desaulniers
  Cc: linux-kbuild, linux-kernel

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>
---
 .../dummy-tools/dummy-plugin-dir/include/plugin-version.h | 0
 scripts/dummy-tools/gcc                                   | 8 ++------
 2 files changed, 2 insertions(+), 6 deletions(-)
 create mode 100644 scripts/dummy-tools/dummy-plugin-dir/include/plugin-version.h

diff --git a/scripts/dummy-tools/dummy-plugin-dir/include/plugin-version.h b/scripts/dummy-tools/dummy-plugin-dir/include/plugin-version.h
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/scripts/dummy-tools/gcc b/scripts/dummy-tools/gcc
index b2483149bbe5..7db825843435 100755
--- a/scripts/dummy-tools/gcc
+++ b/scripts/dummy-tools/gcc
@@ -96,12 +96,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
 
-- 
2.36.1


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

* Re: [PATCH] kbuild: dummy-tools: avoid tmpdir leak in dummy gcc
  2022-07-11 12:09 [PATCH] kbuild: dummy-tools: avoid tmpdir leak in dummy gcc Ondrej Mosnacek
@ 2022-07-12  3:20 ` Masahiro Yamada
  0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2022-07-12  3:20 UTC (permalink / raw)
  To: Ondrej Mosnacek
  Cc: Michal Marek, Nick Desaulniers, Linux Kbuild mailing list,
	Linux Kernel Mailing List

On Mon, Jul 11, 2022 at 9:09 PM Ondrej Mosnacek <omosnace@redhat.com> wrote:
>
> 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>
> ---

Applied to linux-kbuild. Thanks.



>  .../dummy-tools/dummy-plugin-dir/include/plugin-version.h | 0
>  scripts/dummy-tools/gcc                                   | 8 ++------
>  2 files changed, 2 insertions(+), 6 deletions(-)
>  create mode 100644 scripts/dummy-tools/dummy-plugin-dir/include/plugin-version.h
>
> diff --git a/scripts/dummy-tools/dummy-plugin-dir/include/plugin-version.h b/scripts/dummy-tools/dummy-plugin-dir/include/plugin-version.h
> new file mode 100644
> index 000000000000..e69de29bb2d1
> diff --git a/scripts/dummy-tools/gcc b/scripts/dummy-tools/gcc
> index b2483149bbe5..7db825843435 100755
> --- a/scripts/dummy-tools/gcc
> +++ b/scripts/dummy-tools/gcc
> @@ -96,12 +96,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
>
> --
> 2.36.1
>


-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2022-07-12  3:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-11 12:09 [PATCH] kbuild: dummy-tools: avoid tmpdir leak in dummy gcc Ondrej Mosnacek
2022-07-12  3:20 ` Masahiro Yamada

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.