From: sashiko-bot@kernel.org
To: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nicolas Schier" <nsc@kernel.org>
Cc: linux-kbuild@vger.kernel.org, "Nam Cao" <namcao@linutronix.de>,
"kernel test robot" <lkp@intel.com>
Subject: Re: [PATCH RFC] kbuild: enable pipefail for commands where possible
Date: Thu, 15 Oct 2026 08:36:57 +0000 [thread overview]
Message-ID: <sashiko-outbox-172504@kernel.org> (raw)
In-Reply-To: <20261014-kbuild-error-propagation-v1-1-573adaa0a076@linutronix.de>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] kbuild: global pipefail breaks early-exit grep -q pipelines
- [Medium] kbuild: try-pipefail redirection fails to silence errors on unsupported shells
--
commit 144ca777192e6140faa2332a17fb19531eec93bd
Author: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
kbuild: enable pipefail for commands where possible
Enables the shell pipefail option for Kbuild commands where supported, so
that failures of earlier commands in a pipeline are not silently ignored.
Link: https://lore.kernel.org/oe-kbuild-all/202610131613.BpOi6VPp-lkp@intel.com/
> diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
> index 8c311b997e246..1975d2739cdb0 100644
> --- a/scripts/Kbuild.include
> +++ b/scripts/Kbuild.include
> @@ -149,8 +149,11 @@ delete-on-interrupt = \
> $(foreach sig, HUP INT QUIT TERM PIPE, \
> trap 'rm -f $@; trap - $(sig); kill -s $(sig) $$$$' $(sig);))
>
> +# try to enable pipefail
> +try-pipefail = set -o pipefail || true 2>/dev/null
[Severity: Medium]
In POSIX shell grammar, the || operator separates simple commands, meaning
the 2>/dev/null redirection applies exclusively to the true command, not
the set command.
Will this cause build log pollution with 'Illegal option' errors for almost
every compiled file on systems where the shell lacks pipefail support (such
as older versions of dash or minimal busybox ash)?
> # print and execute commands
> -cmd = @$(if $(cmd_$(1)),set -e; $($(quiet)log_print) $(delete-on-interrupt) $(cmd_$(1)),:)
> +cmd = @$(if $(cmd_$(1)),$(try-pipefail); set -e; $($(quiet)log_print) $(delete-on-interrupt) $(cmd_$(1)),:)
[Severity: High]
Kbuild relies on shell conditionals using pipelines that terminate early,
such as the module symbol version generation in scripts/Makefile.build:
if $(NM) $@ 2>/dev/null | grep -q ' __export_symbol_'; then
When grep -q finds a match, it immediately closes its standard input and
exits with 0, causing the upstream command to receive SIGPIPE and exit
with a non-zero status.
With set -o pipefail injected globally into cmd, the pipeline will evaluate
to the non-zero status of the upstream command (e.g., 141), causing the
condition to evaluate to false.
Does this silently disable critical build-time validation and logic, such
as module symbol versioning or vDSO dynamic relocation checks?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261014-kbuild-error-propagation-v1-1-573adaa0a076@linutronix.de?part=1
prev parent reply other threads:[~2026-10-15 8:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 8:30 [PATCH RFC] kbuild: enable pipefail for commands where possible Thomas Weißschuh
2026-10-14 21:40 ` Nathan Chancellor
2026-10-15 10:15 ` Thomas Weißschuh
2026-10-15 8:36 ` sashiko-bot [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=sashiko-outbox-172504@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=lkp@intel.com \
--cc=namcao@linutronix.de \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=thomas.weissschuh@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).