From: Nicolas Schier <nsc@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Dmitry Voytik <voytikd@gmail.com>,
linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org
Subject: Re: [PATCH v7] scripts/config: honor $KBUILD_OUTPUT by default
Date: Sat, 14 Nov 2026 19:56:09 +0100 [thread overview]
Message-ID: <aviuyR8CO027Ch5R@levanger> (raw)
In-Reply-To: <179454594618.814257.8646757102444143940.b4-reply@b4>
On Thu, Nov 12, 2026 at 09:59:06PM -0700, Nathan Chancellor wrote:
> Hi Dmitry,
>
> On 2026-10-06 18:11 +0200, Dmitry Voytik wrote:
> > 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.
> > Handle properly if the config file is a relative path.
> >
> > 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).
>
> I was finally able to sit down and look at this a little bit more. I
> think we can avoid the use of realpath altogether, which would avoid
> most of what Sashiko is complaining about. I tested the following diff
> with your examples and they appear to pass without any issues. Please
> give it a shot.
Thanks, somehow the sashiko mail missed my inbox.
realpath on Linux uses '-E' behaviour by default, which is what we want:
check existence of all directory path components of the given path.
Adding the POSIX '-E' option explicitly should solve the non-Linux
issues.
As a follow-up, I would like to add support for $KCONFIG_CONFIG as well.
> I think we can drop most of the reproduction and
> examples in the commit message. If you want to include them for others,
> please put it below the '---' where you have the changelog, as I don't
> think it needs to end up in git history.
+1
But still thanks for providing the test examples, it was and is indeed
helpful for my follow-up tests.
>
> diff --git a/scripts/config b/scripts/config
> index 32428ea909c2..497551538433 100755
> --- a/scripts/config
> +++ b/scripts/config
> @@ -144,6 +144,22 @@ while [[ $# -gt 0 ]]; do
> fi
> done
>
> +# If no '--file' was specified, use KBUILD_OUTPUT as the base if it exists
> +if [[ "$FN" = ".config" && -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 +216,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 +245,7 @@ while [ "$1" != "" ] ; do
> ;;
>
> --refresh)
> - yes "" | make oldconfig KCONFIG_CONFIG=$FN
> + yes "" | make oldconfig KCONFIG_CONFIG="$FN"
> ;;
>
> *)
>
> --
> Cheers,
> Nathan
>
Looks good to me, thanks.
Reviewed-by: Nicolas Schier <nsc@fjasle.eu>
--
Nicolas
prev parent reply other threads:[~2026-11-14 18:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 16:11 Dmitry Voytik
2026-11-13 4:59 ` Nathan Chancellor
2026-11-14 18:56 ` Nicolas Schier [this message]
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=aviuyR8CO027Ch5R@levanger \
--to=nsc@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathan@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®