mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master 1/2] scripts: sconfigpast: print panic message when nonnull fails
@ 2025-10-10  5:52 Ahmad Fatoum
  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
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2025-10-10  5:52 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-10-10  8:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-10  5:52 [PATCH master 1/2] scripts: sconfigpast: print panic message when nonnull fails Ahmad Fatoum
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox