summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniel Gomez <da.gomez@samsung.com>2026-03-10 14:36:23 +0300
committerNathan Chancellor <nathan@kernel.org>2026-03-11 10:37:50 +0300
commit5f47be1b44bf2754c45e8c58ca036b474c9ecbc7 (patch)
tree753ebdc9b9870270ab5ee06ca04b7e1df9f7efc0 /scripts
parent3b4a3a00de8770f3a60c1fa483921ce37415132d (diff)
downloadlinux-5f47be1b44bf2754c45e8c58ca036b474c9ecbc7.tar.xz
scripts: kconfig: merge_config.sh: pass output file as awk variable
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> Link: https://patch.msgid.link/20260310-fixes-merge-config-v1-1-beaeeaded6bd@samsung.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/kconfig/merge_config.sh18
1 files changed, 7 insertions, 11 deletions
diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index 073c6bec5245..45e6400c68b6 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