Skip to contentSkip to conversation

scripts/config: honor $KBUILD_OUTPUT by default

PATCH Superseded Dmitry Voytik 1 participant 2 messages Sep 20 Kbuild

v1 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/config: honor $KBUILD_OUTPUT by default

If $KBUILD_OUTPUT is set, use it by default if --file is not passed.

Fix the issue when the script silently updates a stale .config in the root directory, while the user expects ${KBUILD_OUTPUT}/.config to be updated.
The problem can be worked around with --file, but this is easy to miss, and is inconsistent with how the Makefile and other tools work (e.g., scripts/diffconfig).

---
 scripts/config | 5 +++++
 1 file changed, 5 insertions(+)
scripts/config +5 -0
index 32428ea909c2..f52ba5e6e27e 100755
@@ -130,6 +130,11 @@ on_exit() {
 trap on_exit EXIT
 
 FN=.config
+if [ -n "${KBUILD_OUTPUT}" ]; then
+	FN=${KBUILD_OUTPUT}/${FN}
+	echo "Using ${FN}"
+fi
+
 CMDS=()
 while [[ $# -gt 0 ]]; do
 	if [ "$1" = "--file" ]; then
Signature · 1 line
2.55.0
#1 lore raw

PATCH v2 1/1 scripts/config: honor $KBUILD_OUTPUT by default

If $KBUILD_OUTPUT is set, use it by default if --file is not passed.

Fix the issue when the script silently updates a stale .config in the root directory, while the user expects ${KBUILD_OUTPUT}/.config to be updated.
The problem can be worked around with --file, but this is easy to miss, and is inconsistent with how the Makefile and other tools work (e.g., scripts/diffconfig).

---
v2:
- Addressed comments by sashiko:
- https://sashiko.dev/#/patchset/20260920064350.17999-1-voytikd%40gmail.com
- use basename when --refresh is used
- remove echo which can be misleading when --file is passed
v1:
- https://lore.kernel.org/all/[email protected]/

---
 scripts/config | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
scripts/config +5 -1
index 32428ea909c2..cdee67157fe1 100755
@@ -130,6 +130,10 @@ on_exit() {
 trap on_exit EXIT
 
 FN=.config
+if [ -n "${KBUILD_OUTPUT}" ]; then
+	FN=${KBUILD_OUTPUT}/${FN}
+fi
+
 CMDS=()
 while [[ $# -gt 0 ]]; do
 	if [ "$1" = "--file" ]; then
@@ -229,7 +233,7 @@ while [ "$1" != "" ] ; do
 		;;
 
 	--refresh)
-		yes "" | make oldconfig KCONFIG_CONFIG=$FN
+		yes "" | make oldconfig KCONFIG_CONFIG=$(basename $FN)
 		;;
 
 	*)
Signature · 1 line
2.55.0