From: Nathan Chancellor <nathan@kernel.org>
To: Julian Braha <julianbraha@gmail.com>
Cc: Dmitry Voytik <voytikd@gmail.com>,
Nicolas Schier <nsc@kernel.org>,
Nicolas Schier <n.schier@fritz.com>,
linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org
Subject: Re: [PATCH v8] scripts/config: honor $KBUILD_OUTPUT by default
Date: Wed, 18 Nov 2026 01:10:25 -0700 [thread overview]
Message-ID: <20261118081025.GA671584@ax162> (raw)
In-Reply-To: <26f53b63-2f75-4fa4-bf6f-d3495e4e5cb0@gmail.com>
On Tue, Nov 17, 2026 at 07:25:17PM +0000, Julian Braha wrote:
> On 11/17/26 13:25, Dmitry Voytik wrote:
> > +# If no '--file' was specified, use KBUILD_OUTPUT as the base if it exists
> > +if [[ "$FN" = ".config" && -n "$KBUILD_OUTPUT" ]]; then
>
> Right so this will give different results with:
> '--file .config'
> and:
> '--file ./.config'
>
> but maybe that was intentional -- i.e. we're assuming a user passing
> '.config' intends it to be '$KBUILD_OUTPUT/.config' while a user passing
> './.config' would intend CWD/.config?
It was intentional since I had figured they were passing the default
value so they should get the default behavior. Maybe it would be better
to only do this when no '--file' value was provided period though to
avoid some unexpected behavior?
diff --git a/scripts/config b/scripts/config
index 32428ea909c2..b09058ea1815 100755
--- a/scripts/config
+++ b/scripts/config
@@ -130,12 +130,14 @@ on_exit() {
trap on_exit EXIT
FN=.config
+USER_SET_FILE=0
CMDS=()
while [[ $# -gt 0 ]]; do
if [ "$1" = "--file" ]; then
if [ "$2" = "" ]; then
usage
fi
+ USER_SET_FILE=1
FN="$2"
shift 2
else
@@ -144,6 +146,22 @@ while [[ $# -gt 0 ]]; do
fi
done
+# If no '--file' was specified, use KBUILD_OUTPUT as the base if it exists
+if [[ "$USER_SET_FILE" = "0" && -n "$KBUILD_OUTPUT" ]]; then
+ if [[ ! -d "$KBUILD_OUTPUT" ]]; then
+ echo "KBUILD_OUTPUT is set ('$KBUILD_OUTPUT') but does not exist or is not a directory." >&2
+ echo "Create it before running $myname or use '--file' to specify configuration file." >&2
+ exit 1
+ fi
+ FN="$KBUILD_OUTPUT/$FN"
+fi
+# Turn FN into an absolute path if it is relative so that '--refresh' works on
+# the correct file. This does not use realpath, as $FN may not exist yet.
+case "$FN" in
+ /*) ;;
+ *) FN="$PWD/$FN" ;;
+esac
+
set -- "${CMDS[@]}"
if [ "$1" = "" ] ; then
usage
@@ -200,10 +218,10 @@ while [ "$1" != "" ] ; do
;;
--state|-s)
- if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then
+ if grep -q "# ${CONFIG_}$ARG is not set" "$FN" ; then
echo n
else
- V="$(grep "^${CONFIG_}$ARG=" $FN)"
+ V="$(grep "^${CONFIG_}$ARG=" "$FN")"
if [ $? != 0 ] ; then
echo undef
else
@@ -229,7 +247,7 @@ while [ "$1" != "" ] ; do
;;
--refresh)
- yes "" | make oldconfig KCONFIG_CONFIG=$FN
+ yes "" | make oldconfig KCONFIG_CONFIG="$FN"
;;
*)
--
Cheers,
Nathan
next prev parent reply other threads:[~2026-11-18 8:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 13:25 Dmitry Voytik
2026-11-17 19:25 ` Julian Braha
2026-11-18 8:10 ` Nathan Chancellor [this message]
2026-11-18 11:14 ` Julian Braha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261118081025.GA671584@ax162 \
--to=nathan@kernel.org \
--cc=julianbraha@gmail.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=n.schier@fritz.com \
--cc=nsc@kernel.org \
--cc=voytikd@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®