mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH master 1/2] scripts: sconfigpast: print panic message when nonnull fails
Date: Fri, 10 Oct 2025 07:52:28 +0200	[thread overview]
Message-ID: <20251010055230.3069354-1-a.fatoum@barebox.org> (raw)

Instead of just exiting with an error code of 2, print out to stderr,
when we abort due to an unexpected NULL pointer.

This helped tracked down a missing dependency in CI.

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 scripts/basic/sconfigpost.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/basic/sconfigpost.c b/scripts/basic/sconfigpost.c
index ddc0528773ff..38f5888865b6 100644
--- a/scripts/basic/sconfigpost.c
+++ b/scripts/basic/sconfigpost.c
@@ -49,13 +49,15 @@ static inline size_t str_has_prefix(const char *str, const char *prefix)
 	return strncmp(str, prefix, len) == 0 ? len : 0;
 }
 
-static void *nonnull(void *ptr)
+static void *pnonnull(void *ptr, const char *ptrname)
 {
 	if (!ptr)
-		exit(2);
+		panic("%s is unexpectedly NULL\n", ptrname);
 	return ptr;
 }
 
+#define nonnull(ptr) pnonnull(ptr, #ptr)
+
 static FILE *xfopen(const char *path, const char *mode)
 {
 	FILE *fp;
@@ -367,6 +369,8 @@ static void append_dependency(FILE *depfile, const char *path)
 		return;
 	}
 
+	debug("appending dependency for %s\n", path);
+
 	abspath = nonnull(realpath(path, NULL));
 
 	fprintf(depfile, "\t%s \\\n", abspath);
-- 
2.47.3




             reply	other threads:[~2025-10-10  5:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-10  5:52 Ahmad Fatoum [this message]
2025-10-10  5:52 ` [PATCH master 2/2] kbuild: fix spurious CI failure around sconfig_names.h Ahmad Fatoum
2025-10-10  8:50 ` [PATCH master 1/2] scripts: sconfigpast: print panic message when nonnull fails Sascha Hauer

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=20251010055230.3069354-1-a.fatoum@barebox.org \
    --to=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