Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Luis Augenstein" <luis.augenstein@tngtech.com>,
	nathan@kernel.org, nsc@kernel.org
Cc: linux-kbuild@vger.kernel.org, akpm@linux-foundation.org,
	gregkh@linuxfoundation.org, kstewart@linuxfoundation.org,
	maximilian.huber@tngtech.com
Subject: Re: [PATCH v6 4/7] kbuild: record cmd-prereqs in .cmd files
Date: Fri, 20 Nov 2026 20:45:32 +0000	[thread overview]
Message-ID: <sashiko-outbox-226092@kernel.org> (raw)
In-Reply-To: <20261119204457.9968-5-luis.augenstein@tngtech.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] kbuild: fixdep: strip leading ./ from dep->name in
  print_make_prereqs()
--

commit 893f80d84c71797a734bc7704bb47fc515aee146
Author: Luis Augenstein <luis.augenstein@tngtech.com>

kbuild: record cmd-prereqs in .cmd files

This commit records prerequisites not covered by deps_<target> as
make_prereqs_<target> in .cmd files and teaches fixdep to filter out
dependencies from the current depfile.

Link: https://lore.kernel.org/r/a01233b9-23a2-4666-91ed-f1cf030dcb9f@tngtech.com

> diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
> index 8c311b997e246..94a0711b66934 100644
> --- a/scripts/Kbuild.include
> +++ b/scripts/Kbuild.include
> @@ -181,6 +181,9 @@ endif
>  # (needed for the shell)
>  make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1)))))
>  
> +# prerequisites to record in .cmd files, excluding those covered in deps_*
> +cmd-prereqs = $(call escsq,$(filter-out $(patsubst ./%,%,$(deps_$@)), $(real-prereqs)))
> +
[ ... ]
> diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
> index f514ef606ec63..005c1c3df494a 100644
> --- a/scripts/basic/fixdep.c
> +++ b/scripts/basic/fixdep.c
[ ... ]
> @@ -478,23 +480,63 @@ static void print_dep_file(const char *target, const struct dep_info *info)
>  	printf("$(deps_%s):\n", target);
>  }
>  
> +/*
> + * Print make_prereqs_<target> from prereqs, excluding the deps listed
> + * in info.
> + */
> +static void print_make_prereqs(const char *target, const char *prereqs,
> +			       const struct dep_info *info)
> +{
> +	struct item *seen_prereqs_hashtab[HASHSZ] = {};
> +	const struct dep_item *dep;
> +	const char *p = prereqs;
> +
> +	for (dep = info->deps; dep; dep = dep->next)
> +		in_hashtable(dep->name, strlen(dep->name),
> +			     seen_prereqs_hashtab);

[Severity: Low]
Should print_make_prereqs() strip a leading "./" from dep->name before
inserting it into seen_prereqs_hashtab?

Make strips leading "./" from prerequisites in $(real-prereqs), whereas
compiler depfiles record paths under -I./include (and similar flags using
$(objtree) or $(srctree) when set to ".") with a leading "./".  On a clean
build, those dep->name entries will not match the tokens in prereqs and
will be recorded in both make_prereqs_<target> and deps_<target>, while an
incremental build filters them out via $(patsubst ./%,%,$(deps_$@)) in
cmd-prereqs.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119204457.9968-1-luis.augenstein@tngtech.com?part=4

  reply	other threads:[~2026-11-20 20:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 20:44 [PATCH v6 0/7] kbuild: record cmd-prereqs in .cmd files Luis Augenstein
2026-11-19 20:44 ` [PATCH v6 1/7] scripts/make_fit: limit .cmd file parsing to the savedcmd_ line Luis Augenstein
2026-11-19 20:44 ` [PATCH v6 2/7] kbuild: refactor fixdep to collect dependencies before printing Luis Augenstein
2026-11-19 20:44 ` [PATCH v6 3/7] scripts/sbom: skip make_prereqs lines when parsing .cmd files Luis Augenstein
2026-11-19 20:44 ` [PATCH v6 4/7] kbuild: record cmd-prereqs in " Luis Augenstein
2026-11-20 20:45   ` sashiko-bot [this message]
2026-11-19 20:44 ` [PATCH v6 5/7] scripts/sbom: parse make_prereqs from " Luis Augenstein
2026-11-19 20:44 ` [PATCH v6 6/7] scripts/sbom: use make_prereqs to determine build inputs Luis Augenstein
2026-11-19 20:44 ` [PATCH v6 7/7] scripts/sbom: remove the command-specific parsers Luis Augenstein

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=sashiko-outbox-226092@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=luis.augenstein@tngtech.com \
    --cc=maximilian.huber@tngtech.com \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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