The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] scripts: kconfig: merge_config.sh: keep temp file in the output dir
@ 2026-07-08 11:04 Gustavo Luiz Duarte
  2026-07-08 12:18 ` Breno Leitao
  2026-07-08 18:47 ` Nicolas Schier
  0 siblings, 2 replies; 4+ messages in thread
From: Gustavo Luiz Duarte @ 2026-07-08 11:04 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Breno Leitao
  Cc: linux-kbuild, linux-kernel, Gustavo Luiz Duarte

merge_config.sh currently creates a temporary file in the current
directory. Create it under $OUTPUT instead, which allows running the
script against a read-only source tree.

The default behavior is unchanged: $OUTPUT is "." so the file stays in
the cwd.

Signed-off-by: Gustavo Luiz Duarte <gustavold@gmail.com>
---
 scripts/kconfig/merge_config.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index f08e0863b7128..a63250d4cbf12 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -122,7 +122,7 @@ fi
 
 MERGE_LIST=$*
 
-TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)
+TMP_FILE=$(mktemp "$OUTPUT/.tmp.config.XXXXXXXXXX")
 
 echo "Using $INITFILE as base"
 

---
base-commit: 0e35b9b6ec0ffcc5e23cbdec09f5c622ad532b53
change-id: 20260708-merge_config_output-d90c161a923c

Best regards,
-- 
Gustavo Luiz Duarte <gustavold@gmail.com>


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

* Re: [PATCH] scripts: kconfig: merge_config.sh: keep temp file in the output dir
  2026-07-08 11:04 [PATCH] scripts: kconfig: merge_config.sh: keep temp file in the output dir Gustavo Luiz Duarte
@ 2026-07-08 12:18 ` Breno Leitao
  2026-07-08 18:47 ` Nicolas Schier
  1 sibling, 0 replies; 4+ messages in thread
From: Breno Leitao @ 2026-07-08 12:18 UTC (permalink / raw)
  To: Gustavo Luiz Duarte
  Cc: Nathan Chancellor, Nicolas Schier, linux-kbuild, linux-kernel

On Wed, Jul 08, 2026 at 04:04:54AM -0700, Gustavo Luiz Duarte wrote:
> merge_config.sh currently creates a temporary file in the current
> directory. Create it under $OUTPUT instead, which allows running the
> script against a read-only source tree.
> 
> The default behavior is unchanged: $OUTPUT is "." so the file stays in
> the cwd.
> 
> Signed-off-by: Gustavo Luiz Duarte <gustavold@gmail.com>

Reviewed-by: Breno Leitao <leitao@debian.org>

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

* Re: [PATCH] scripts: kconfig: merge_config.sh: keep temp file in the output dir
  2026-07-08 11:04 [PATCH] scripts: kconfig: merge_config.sh: keep temp file in the output dir Gustavo Luiz Duarte
  2026-07-08 12:18 ` Breno Leitao
@ 2026-07-08 18:47 ` Nicolas Schier
  2026-07-09 16:42   ` Gustavo Luiz Duarte
  1 sibling, 1 reply; 4+ messages in thread
From: Nicolas Schier @ 2026-07-08 18:47 UTC (permalink / raw)
  To: Gustavo Luiz Duarte
  Cc: Nathan Chancellor, Breno Leitao, linux-kbuild, linux-kernel

On Wed, Jul 08, 2026 at 04:04:54AM -0700, Gustavo Luiz Duarte wrote:
> merge_config.sh currently creates a temporary file in the current
> directory. Create it under $OUTPUT instead, which allows running the
> script against a read-only source tree.
> 
> The default behavior is unchanged: $OUTPUT is "." so the file stays in
> the cwd.

Out of curiosity: in which situation do you need this fix?

> 
> Signed-off-by: Gustavo Luiz Duarte <gustavold@gmail.com>
> ---
>  scripts/kconfig/merge_config.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
> index f08e0863b7128..a63250d4cbf12 100755
> --- a/scripts/kconfig/merge_config.sh
> +++ b/scripts/kconfig/merge_config.sh
> @@ -122,7 +122,7 @@ fi
>  
>  MERGE_LIST=$*
>  
> -TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)
> +TMP_FILE=$(mktemp "$OUTPUT/.tmp.config.XXXXXXXXXX")

<bike-shedding>
While this does as written in the commit message, I'd rather expected
something like

 mktemp --tmpdir="$OUTPUT" .tmp.config.XXXXXXXXXX

instead.
</bike-shedding>


When I am reading the help text for merge_config.sh's '-O', I think we
should adjust the default output directory as well:

  -O    dir to put generated output files.  Consider setting $KCONFIG_CONFIG instead.

With a read-only source tree in mind, KCONFIG_CONFIG probably has to be
set, otherwise we'd not need to put the temporary file somewhere else.
Might it be more consistent to use $(dirname ${KBUILD_KCONFIG}) as
default for OUTPUT instead of '.'?

So, once again: in which situation do you need the fix?  Is it really
sufficient as it is?


Nevertheless, I think it's a good idea, thanks for the patch.

Kind regards,
Nicolas

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

* Re: [PATCH] scripts: kconfig: merge_config.sh: keep temp file in the output dir
  2026-07-08 18:47 ` Nicolas Schier
@ 2026-07-09 16:42   ` Gustavo Luiz Duarte
  0 siblings, 0 replies; 4+ messages in thread
From: Gustavo Luiz Duarte @ 2026-07-09 16:42 UTC (permalink / raw)
  To: Gustavo Luiz Duarte, Nathan Chancellor, Breno Leitao,
	linux-kbuild, linux-kernel

On Wed, Jul 8, 2026 at 7:48 PM Nicolas Schier <nsc@kernel.org> wrote:
>
> On Wed, Jul 08, 2026 at 04:04:54AM -0700, Gustavo Luiz Duarte wrote:
> > merge_config.sh currently creates a temporary file in the current
> > directory. Create it under $OUTPUT instead, which allows running the
> > script against a read-only source tree.
> >
> > The default behavior is unchanged: $OUTPUT is "." so the file stays in
> > the cwd.
>
> Out of curiosity: in which situation do you need this fix?

Our build runs in a container that mounts the source tree read-only and outputs
the build artifacts into a separate rw mount point. We have our own (cruder)
flavor of merge_config.sh and I want to use the upstream script instead.

>
> >
> > Signed-off-by: Gustavo Luiz Duarte <gustavold@gmail.com>
> > ---
> >  scripts/kconfig/merge_config.sh | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
> > index f08e0863b7128..a63250d4cbf12 100755
> > --- a/scripts/kconfig/merge_config.sh
> > +++ b/scripts/kconfig/merge_config.sh
> > @@ -122,7 +122,7 @@ fi
> >
> >  MERGE_LIST=$*
> >
> > -TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)
> > +TMP_FILE=$(mktemp "$OUTPUT/.tmp.config.XXXXXXXXXX")
>
> <bike-shedding>
> While this does as written in the commit message, I'd rather expected
> something like
>
>  mktemp --tmpdir="$OUTPUT" .tmp.config.XXXXXXXXXX
>
> instead.
> </bike-shedding>

I can send a v2 with --tmpdir=

>
>
> When I am reading the help text for merge_config.sh's '-O', I think we
> should adjust the default output directory as well:
>
>   -O    dir to put generated output files.  Consider setting $KCONFIG_CONFIG instead.
>
> With a read-only source tree in mind, KCONFIG_CONFIG probably has to be
> set, otherwise we'd not need to put the temporary file somewhere else.
> Might it be more consistent to use $(dirname ${KBUILD_KCONFIG}) as
> default for OUTPUT instead of '.'?

Maybe, but then, as far as I understand it, setting a custom KBUILD_KCONFIG
would lead to object files (like the conf binary and other object files) being
put into $(dirname ${KBUILD_KCONFIG}). Is that the intention?

>
> So, once again: in which situation do you need the fix?  Is it really
> sufficient as it is?

$KCONFIG_CONFIG is already derived from $OUTPUT, so the current patch is
sufficient for our read-only source tree use-case.

Thanks for the review!

Kind regards,
Gustavo

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

end of thread, other threads:[~2026-07-09 16:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08 11:04 [PATCH] scripts: kconfig: merge_config.sh: keep temp file in the output dir Gustavo Luiz Duarte
2026-07-08 12:18 ` Breno Leitao
2026-07-08 18:47 ` Nicolas Schier
2026-07-09 16:42   ` Gustavo Luiz Duarte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox