[PATCH] lib: add explicit declaration of environ

Subject: [PATCH] lib: add explicit declaration of environ

Date: Thu, 15 Oct 2026 07:43:39 -0300

To: Frank Seifferth, David Bremner, Anton Khirnov, notmuch@notmuchmail.org

Cc:

From: David Bremner


In [1], Frank Seifferth observed that the (non-standard) implicit
declaration of environ does not happen on NetBSD. In my experiments it
seems fine to have duplicate extern declarations, so add an
unconditional explicit declaration. Put said declaration in
notmuch-private.h to roughly match the scope of the existing
Linux/glibc declaration.

[1]: id:20261013185701.GA461860852832869@posteo.net
---
Please test. I don't have a netbsd environment handy.

 lib/notmuch-private.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index ba07083b..ab4b926b 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -53,6 +53,10 @@ NOTMUCH_BEGIN_DECLS
 
 #include <talloc.h>
 
+/* Needed for places (e.g. NetBSD) where _GNU_SOURCE does not enable
+ * this declaration */
+extern char **environ;
+
 #ifdef DEBUG
 # define DEBUG_DATABASE_SANITY 1
 # define DEBUG_THREADING 1
-- 
2.53.0

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: