mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix merge_config.sh
@ 2026-03-10 11:36 Daniel Gomez
  2026-03-10 11:36 ` [PATCH 1/3] scripts: kconfig: merge_config.sh: pass output file as awk variable Daniel Gomez
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Daniel Gomez @ 2026-03-10 11:36 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Anders Roxell, Mikko Rapeli
  Cc: linux-kbuild, linux-kernel, Daniel Gomez

Restore empty base file support introduced by a26fe287eed1 ("kconfig:
merge_config: use an empty file as initfile") broken by the awk
refactoring in 5fa9b82cbcfc ("scripts: kconfig: merge_config.sh:
refactor from shell/sed/grep to awk"). Also fix POSIX compatibility for
non-bash /bin/sh and clean up whitespace.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
Daniel Gomez (3):
      scripts: kconfig: merge_config.sh: pass output file as awk variable
      scripts: kconfig: merge_config.sh: fix indentation
      scripts: kconfig: merge_config.sh: use POSIX test operator

 scripts/kconfig/merge_config.sh | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)
---
base-commit: 11439c4635edd669ae435eec308f4ab8a0804808
change-id: 20260310-fixes-merge-config-606c2a4ed83e

Best regards,
--  
Daniel Gomez <da.gomez@samsung.com>


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

* [PATCH 1/3] scripts: kconfig: merge_config.sh: pass output file as awk variable
  2026-03-10 11:36 [PATCH 0/3] Fix merge_config.sh Daniel Gomez
@ 2026-03-10 11:36 ` Daniel Gomez
  2026-03-10 11:36 ` [PATCH 2/3] scripts: kconfig: merge_config.sh: fix indentation Daniel Gomez
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Gomez @ 2026-03-10 11:36 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Anders Roxell, Mikko Rapeli
  Cc: linux-kbuild, linux-kernel, Daniel Gomez

From: Daniel Gomez <da.gomez@samsung.com>

The refactoring commit 5fa9b82cbcfc5 ("scripts: kconfig:
merge_config.sh: refactor from shell/sed/grep to awk") passes
$TMP_FILE.new as ARGV[3] to awk, using it as both an output destination
and an input file argument. When the base file is empty, nothing is
written to ARGV[3] during processing, so awk fails trying to open it
for reading:

    awk: cmd. line:52: fatal: cannot open file
    `./.tmp.config.grcQin34jb.new' for reading: No such file or directory
    mv: cannot stat './.tmp.config.grcQin34jb.new': No such file or directory

Pass the output path via -v outfile instead and drop the FILENAME ==
ARGV[3] { nextfile }.

Fixes: 5fa9b82cbcfc5 ("scripts: kconfig: merge_config.sh: refactor from shell/sed/grep to awk")

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
 scripts/kconfig/merge_config.sh | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index 735e1de450c6..5177bde69c1d 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -151,6 +151,7 @@ for ORIG_MERGE_FILE in $MERGE_LIST ; do
 	if ! "$AWK" -v prefix="$CONFIG_PREFIX" \
 		-v warnoverride="$WARNOVERRIDE" \
 		-v strict="$STRICT" \
+		-v outfile="$TMP_FILE.new" \
 		-v builtin="$BUILTIN" \
 		-v warnredun="$WARNREDUN" '
 	BEGIN {
@@ -212,7 +213,7 @@ for ORIG_MERGE_FILE in $MERGE_LIST ; do
 
 		# Not a config or not in merge file - keep it
 		if (cfg == "" || !(cfg in merge_cfg)) {
-			print $0 >> ARGV[3]
+			print $0 >> outfile
 			next
 		}
 
@@ -222,7 +223,7 @@ for ORIG_MERGE_FILE in $MERGE_LIST ; do
 		# BUILTIN: do not demote y to m
 		if (builtin == "true" && new_val ~ /=m$/ && prev_val ~ /=y$/) {
 			warn_builtin(cfg, prev_val, new_val)
-			print $0 >> ARGV[3]
+			print $0 >> outfile
 			skip_merge[merge_cfg_line[cfg]] = 1
 			next
 		}
@@ -235,7 +236,7 @@ for ORIG_MERGE_FILE in $MERGE_LIST ; do
 
 		# "=n" is the same as "is not set"
 		if (prev_val ~ /=n$/ && new_val ~ / is not set$/) {
-			print $0 >> ARGV[3]
+			print $0 >> outfile
 			next
 		}
 
@@ -246,25 +247,20 @@ for ORIG_MERGE_FILE in $MERGE_LIST ; do
 		}
 	}
 
-	# output file, skip all lines
-	FILENAME == ARGV[3] {
-		nextfile
-	}
-
 	END {
 		# Newline in case base file lacks trailing newline
-		print "" >> ARGV[3]
+		print "" >> outfile
 		# Append merge file, skipping lines marked for builtin preservation
 		for (i = 1; i <= merge_total; i++) {
 			if (!(i in skip_merge)) {
-				print merge_lines[i] >> ARGV[3]
+				print merge_lines[i] >> outfile
 			}
 		}
 		if (strict_violated) {
 			exit 1
 		}
 	}' \
-	"$ORIG_MERGE_FILE" "$TMP_FILE" "$TMP_FILE.new"; then
+	"$ORIG_MERGE_FILE" "$TMP_FILE"; then
 		# awk exited non-zero, strict mode was violated
 		STRICT_MODE_VIOLATED=true
 	fi

-- 
2.53.0


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

* [PATCH 2/3] scripts: kconfig: merge_config.sh: fix indentation
  2026-03-10 11:36 [PATCH 0/3] Fix merge_config.sh Daniel Gomez
  2026-03-10 11:36 ` [PATCH 1/3] scripts: kconfig: merge_config.sh: pass output file as awk variable Daniel Gomez
@ 2026-03-10 11:36 ` Daniel Gomez
  2026-03-10 11:36 ` [PATCH 3/3] scripts: kconfig: merge_config.sh: use POSIX test operator Daniel Gomez
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Gomez @ 2026-03-10 11:36 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Anders Roxell, Mikko Rapeli
  Cc: linux-kbuild, linux-kernel, Daniel Gomez

From: Daniel Gomez <da.gomez@samsung.com>

Replace spaces with tabs for consistency with the rest of the script.

Fixes: 5fa9b82cbcfc5 ("scripts: kconfig: merge_config.sh: refactor from shell/sed/grep to awk")

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
 scripts/kconfig/merge_config.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index 5177bde69c1d..95f090b88e8d 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -196,7 +196,7 @@ for ORIG_MERGE_FILE in $MERGE_LIST ; do
 
 	# First pass: read merge file, store all lines and index
 	FILENAME == ARGV[1] {
-	        mergefile = FILENAME
+		mergefile = FILENAME
 		merge_lines[FNR] = $0
 		merge_total = FNR
 		cfg = get_cfg($0)
@@ -217,7 +217,7 @@ for ORIG_MERGE_FILE in $MERGE_LIST ; do
 			next
 		}
 
-	        prev_val = $0
+		prev_val = $0
 		new_val = merge_cfg[cfg]
 
 		# BUILTIN: do not demote y to m

-- 
2.53.0


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

* [PATCH 3/3] scripts: kconfig: merge_config.sh: use POSIX test operator
  2026-03-10 11:36 [PATCH 0/3] Fix merge_config.sh Daniel Gomez
  2026-03-10 11:36 ` [PATCH 1/3] scripts: kconfig: merge_config.sh: pass output file as awk variable Daniel Gomez
  2026-03-10 11:36 ` [PATCH 2/3] scripts: kconfig: merge_config.sh: fix indentation Daniel Gomez
@ 2026-03-10 11:36 ` Daniel Gomez
  2026-03-11  7:50 ` [PATCH 0/3] Fix merge_config.sh Nathan Chancellor
  2026-03-23  0:58 ` (subset) " Nathan Chancellor
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Gomez @ 2026-03-10 11:36 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Anders Roxell, Mikko Rapeli
  Cc: linux-kbuild, linux-kernel, Daniel Gomez

From: Daniel Gomez <da.gomez@samsung.com>

The script uses #!/bin/sh but == for string comparison, which is a bash
extension. This causes an error on systems where /bin/sh is not bash:

    ./scripts/kconfig/merge_config.sh: 380: [: false: unexpected operator

Use = instead, as used in the rest of the script.

Fixes: dfc97e1c5da5b ("scripts: kconfig: merge_config.sh: use awk in checks too")

Signed-off-by: Daniel Gomez <da.gomez@samsung.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 95f090b88e8d..f08e0863b712 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -377,7 +377,7 @@ END {
 	STRICT_MODE_VIOLATED=true
 fi
 
-if [ "$STRICT" == "true" ] && [ "$STRICT_MODE_VIOLATED" == "true" ]; then
+if [ "$STRICT" = "true" ] && [ "$STRICT_MODE_VIOLATED" = "true" ]; then
 	echo "Requested and effective config differ"
 	exit 1
 fi

-- 
2.53.0


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

* Re: [PATCH 0/3] Fix merge_config.sh
  2026-03-10 11:36 [PATCH 0/3] Fix merge_config.sh Daniel Gomez
                   ` (2 preceding siblings ...)
  2026-03-10 11:36 ` [PATCH 3/3] scripts: kconfig: merge_config.sh: use POSIX test operator Daniel Gomez
@ 2026-03-11  7:50 ` Nathan Chancellor
  2026-03-23  0:58 ` (subset) " Nathan Chancellor
  4 siblings, 0 replies; 6+ messages in thread
From: Nathan Chancellor @ 2026-03-11  7:50 UTC (permalink / raw)
  To: Daniel Gomez
  Cc: Nicolas Schier, Anders Roxell, Mikko Rapeli, linux-kbuild,
	linux-kernel, Daniel Gomez

On Tue, Mar 10, 2026 at 12:36:22PM +0100, Daniel Gomez wrote:
> Restore empty base file support introduced by a26fe287eed1 ("kconfig:
> merge_config: use an empty file as initfile") broken by the awk
> refactoring in 5fa9b82cbcfc ("scripts: kconfig: merge_config.sh:
> refactor from shell/sed/grep to awk"). Also fix POSIX compatibility for
> non-bash /bin/sh and clean up whitespace.
> 
> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
> ---
> Daniel Gomez (3):
>       scripts: kconfig: merge_config.sh: pass output file as awk variable
>       scripts: kconfig: merge_config.sh: fix indentation

Thanks, I have tentatively applied these to kbuild-fixes-unstable,
pending further comments and reviews from folks. I will send out a
message when they are formally applied to kbuild-fixes.

>       scripts: kconfig: merge_config.sh: use POSIX test operator

Someone else submitted a patch a couple of days ago for this, it is
already in kbuild-fixes:

  https://git.kernel.org/kbuild/c/3b4a3a00de8770f3a60c1fa483921ce37415132d

Cheers,
Nathan

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

* Re: (subset) [PATCH 0/3] Fix merge_config.sh
  2026-03-10 11:36 [PATCH 0/3] Fix merge_config.sh Daniel Gomez
                   ` (3 preceding siblings ...)
  2026-03-11  7:50 ` [PATCH 0/3] Fix merge_config.sh Nathan Chancellor
@ 2026-03-23  0:58 ` Nathan Chancellor
  4 siblings, 0 replies; 6+ messages in thread
From: Nathan Chancellor @ 2026-03-23  0:58 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Anders Roxell, Mikko Rapeli,
	Daniel Gomez
  Cc: linux-kbuild, linux-kernel, Daniel Gomez

On Tue, 10 Mar 2026 12:36:22 +0100, Daniel Gomez wrote:
> Restore empty base file support introduced by a26fe287eed1 ("kconfig:
> merge_config: use an empty file as initfile") broken by the awk
> refactoring in 5fa9b82cbcfc ("scripts: kconfig: merge_config.sh:
> refactor from shell/sed/grep to awk"). Also fix POSIX compatibility for
> non-bash /bin/sh and clean up whitespace.
> 
> 
> [...]

Applied to

  https://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git kbuild-fixes

Thanks!

[1/3] scripts: kconfig: merge_config.sh: pass output file as awk variable
      (no commit info)
[2/3] scripts: kconfig: merge_config.sh: fix indentation
      (no commit info)

Please look out for regression or issue reports or other follow up
comments, as they may result in the patch/series getting dropped or
reverted. Patches applied to an "unstable" branch are accepted pending
wider testing in -next and any post-commit review; they will generally
be moved to the main branch in a week if no issues are found.

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>


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

end of thread, other threads:[~2026-03-23  0:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-10 11:36 [PATCH 0/3] Fix merge_config.sh Daniel Gomez
2026-03-10 11:36 ` [PATCH 1/3] scripts: kconfig: merge_config.sh: pass output file as awk variable Daniel Gomez
2026-03-10 11:36 ` [PATCH 2/3] scripts: kconfig: merge_config.sh: fix indentation Daniel Gomez
2026-03-10 11:36 ` [PATCH 3/3] scripts: kconfig: merge_config.sh: use POSIX test operator Daniel Gomez
2026-03-11  7:50 ` [PATCH 0/3] Fix merge_config.sh Nathan Chancellor
2026-03-23  0:58 ` (subset) " Nathan Chancellor

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

all inboxes | Powered by JetHome®