From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH v3 12/12] boot: report exit status of failing boot scripts
Date: Mon, 26 Oct 2026 13:10:03 +0100 [thread overview]
Message-ID: <20261026121150.455510-13-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20261026121150.455510-1-a.fatoum@pengutronix.de>
From: Ahmad Fatoum <a.fatoum@barebox.org>
A boot script that runs, but fails, makes execute_binfmt() return its
positive exit status, while bootscript_boot() treats any non-zero value
as negative error code. A failing script thus logs nonsense:
Running script '/env/boot/foo' failed: error -1
Booting entry 'foo' failed: 0000000000000001
Let's print the exit status instead and return -EINVAL, so boot_entry()
and other callers get the negative error code they expect.
Fixes: 662ff5a3558e ("boot: make it a little bit less verbose")
Assisted-by: Claude:opus-5.5
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
common/boot.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/common/boot.c b/common/boot.c
index c7fa170224b1..00c95eb7f5f7 100644
--- a/common/boot.c
+++ b/common/boot.c
@@ -117,8 +117,13 @@ static int bootscript_boot(struct bootentry *entry, int verbose, int dryrun)
* without the shell expanding or splitting it first.
*/
ret = execute_binfmt(bs->args ? 2 : 1, argv);
- if (ret) {
- pr_err("Running script '%s' failed: %s\n", bs->entry.path, strerror(-ret));
+ if (ret > 0) {
+ pr_err("Running script '%s' failed with exit status %d\n",
+ bs->entry.path, ret);
+ ret = -EINVAL;
+ goto out;
+ } else if (ret) {
+ pr_err("Running script '%s' failed: %pe\n", bs->entry.path, ERR_PTR(ret));
goto out;
}
--
2.47.3
prev parent reply other threads:[~2026-10-26 13:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 12:09 [PATCH v3 00/12] efi: payload: allow passing arguments to UKIs Ahmad Fatoum
2026-10-26 12:09 ` [PATCH v3 01/12] efi: treat EFI zboot Linux images like other EFI-stubbed kernels Ahmad Fatoum
2026-10-26 12:09 ` [PATCH v3 02/12] commands: devlookup: honour global.bootm.root_param for -k Ahmad Fatoum
2026-10-26 12:09 ` [PATCH v3 03/12] common: bootargs: don't leave linux_bootargs dangling after free Ahmad Fatoum
2026-10-26 12:09 ` [PATCH v3 04/12] common: bootargs: drop legacy bootargs fallback with FLEXIBLE_BOOTARGS Ahmad Fatoum
2026-10-26 12:09 ` [PATCH v3 05/12] globalvar: skip empty variables in globalvar_get_match() Ahmad Fatoum
2026-10-26 12:09 ` [PATCH v3 06/12] efi: payload: honour bootm dryrun in the EFI application handler Ahmad Fatoum
2026-10-26 12:09 ` [PATCH v3 07/12] efi: payload: always shutdown barebox when booting Ahmad Fatoum
2026-10-26 12:09 ` [PATCH v3 08/12] efi: payload: pass shell arguments as load options to executed images Ahmad Fatoum
2026-10-26 12:10 ` [PATCH v3 09/12] efi: add global.efi.bootargs for bootm'd EFI applications Ahmad Fatoum
2026-10-26 12:10 ` [PATCH v3 10/12] Documentation: efi: describe load options handling Ahmad Fatoum
2026-10-26 12:10 ` [PATCH v3 11/12] test: py: efiloader: check global.efi.bootargs reaches the kernel Ahmad Fatoum
2026-10-26 12:10 ` Ahmad Fatoum [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=20261026121150.455510-13-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.org \
/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