--- /dev/null
+Return-Path: <wiz@danbala.ifoer.tuwien.ac.at>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 7E686431FBC\r
+ for <notmuch@notmuchmail.org>; Fri, 3 Jan 2014 13:53:51 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id iwjkVjClywfP for <notmuch@notmuchmail.org>;\r
+ Fri, 3 Jan 2014 13:53:42 -0800 (PST)\r
+X-Greylist: delayed 361 seconds by postgrey-1.32 at olra;\r
+ Fri, 03 Jan 2014 13:53:42 PST\r
+Received: from danbala.ifoer.tuwien.ac.at (danbala.ifoer.tuwien.ac.at\r
+ [128.130.168.64])\r
+ by olra.theworths.org (Postfix) with ESMTP id 898E8431FB6\r
+ for <notmuch@notmuchmail.org>; Fri, 3 Jan 2014 13:53:42 -0800 (PST)\r
+Received: by danbala.ifoer.tuwien.ac.at (Postfix, from userid 116)\r
+ id 0665B390DAF; Fri, 3 Jan 2014 22:47:35 +0100 (CET)\r
+Date: Fri, 3 Jan 2014 22:47:35 +0100\r
+From: Thomas Klausner <tk@giga.or.at>\r
+To: notmuch@notmuchmail.org\r
+Subject: notmuch-0.16: realpath() compatibility issue; clang visibility\r
+ problem\r
+Message-ID: <20140103214735.GG27614@danbala.tuwien.ac.at>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/mixed; boundary="cNdxnHkX5QqsyA0e"\r
+Content-Disposition: inline\r
+X-Mailman-Approved-At: Sat, 04 Jan 2014 04:25:46 -0800\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 03 Jan 2014 21:53:51 -0000\r
+\r
+\r
+--cNdxnHkX5QqsyA0e\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+\r
+Hi!\r
+\r
+I'm currently starting to try out notmuch-0.16 on NetBSD. It went off\r
+to a rocky start, since it segfaulted in the initial config setup.\r
+\r
+Debugging it I found that notmuch uses a glibc extension to realpath,\r
+allowing NULL as second argument.\r
+\r
+I've converted it to use a prepared buffer instead; attached is a\r
+possible patch that makes notmuch complete its setup phase for me, and\r
+adds inclusion of the header files suggested by the realpath man page\r
+on NetBSD. Please address this issue in some way in the next release.\r
+\r
+Additionally, when compiling with clang, there are issues with the\r
+visibility. The symptoms are:\r
+\r
+In file included from lib/database.cc:21:\r
+In file included from ./lib/database-private.h:33:\r
+./lib/notmuch-private.h:479:8: error: visibility does not match previous declaration\r
+array subscriptstruct visible _notmuch_string_list {\r
+ ^\r
+./lib/notmuch-private.h:67:33: note: expanded from macro 'visible'\r
+ # define visible __attribute__((visibility("default")))\r
+ ^\r
+./lib/notmuch-private.h:52:13: note: previous attribute is here\r
+#pragma GCC visibility push(hidden)\r
+ ^\r
+\r
+In file included from lib/parse-time-vrp.cc:23:\r
+In file included from ./lib/database-private.h:33:\r
+./lib/notmuch-private.h:479:8: error: visibility does not match previous declaration\r
+struct visible _notmuch_string_list {\r
+ ^\r
+./lib/notmuch-private.h:67:33: note: expanded from macro 'visible'\r
+# define visible __attribute__((visibility("default")))\r
+ ^\r
+./lib/notmuch-private.h:52:13: note: previous attribute is here\r
+#pragma GCC visibility push(hidden)\r
+ ^\r
+1 warning generated.\r
+In file included from lib/directory.cc:21:\r
+./lib/notmuch-private.h:479:8: error: visibility does not match previous declaration\r
+struct visible _notmuch_string_list {\r
+ ^\r
+./lib/notmuch-private.h:67:33: note: expanded from macro 'visible'\r
+# define visible __attribute__((visibility("default")))\r
+ ^\r
+./lib/notmuch-private.h:52:13: note: previous attribute is here\r
+#pragma GCC visibility push(hidden)\r
+ ^\r
+\r
+and so on. I guess it is because the visibility differs between c and\r
+c++. I've disabled visibility locally, see second attached patch, but\r
+of course that's not a solution, just a workaround. Suggestions\r
+welcome.\r
+\r
+Thanks,\r
+ Thomas\r
+\r
+--cNdxnHkX5QqsyA0e\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: attachment; filename="patch-notmuch-config.c"\r
+\r
+$NetBSD$\r
+\r
+NULL as second argument for realpath() is only supported in glibc.\r
+Use more portable code.\r
+\r
+--- notmuch-config.c.orig 2013-08-03 11:29:40.000000000 +0000\r
++++ notmuch-config.c\r
+@@ -23,6 +23,8 @@\r
+ #include <pwd.h>\r
+ #include <netdb.h>\r
+ #include <assert.h>\r
++#include <sys/param.h>\r
++#include <stdlib.h>\r
+ \r
+ static const char toplevel_config_comment[] =\r
+ " .notmuch-config - Configuration file for the notmuch mail system\n"\r
+@@ -444,7 +446,7 @@ int\r
+ notmuch_config_save (notmuch_config_t *config)\r
+ {\r
+ size_t length;\r
+- char *data, *filename;\r
++ char *data, filename[MAXPATHLEN];\r
+ GError *error = NULL;\r
+ \r
+ data = g_key_file_to_data (config->key_file, &length, NULL);\r
+@@ -454,15 +456,9 @@ notmuch_config_save (notmuch_config_t *c\r
+ }\r
+ \r
+ /* Try not to overwrite symlinks. */\r
+- filename = realpath (config->filename, NULL);\r
+- if (! filename) {\r
++ if (! realpath (config->filename, filename)) {\r
+ if (errno == ENOENT) {\r
+- filename = strdup (config->filename);\r
+- if (! filename) {\r
+- fprintf (stderr, "Out of memory.\n");\r
+- g_free (data);\r
+- return 1;\r
+- }\r
++ strcpy(filename, config->filename);\r
+ } else {\r
+ fprintf (stderr, "Error canonicalizing %s: %s\n", config->filename,\r
+ strerror (errno));\r
+@@ -480,12 +476,10 @@ notmuch_config_save (notmuch_config_t *c\r
+ filename, error->message);\r
+ }\r
+ g_error_free (error);\r
+- free (filename);\r
+ g_free (data);\r
+ return 1;\r
+ }\r
+ \r
+- free (filename);\r
+ g_free (data);\r
+ return 0;\r
+ }\r
+\r
+--cNdxnHkX5QqsyA0e\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: attachment; filename="patch-lib_notmuch-private.h"\r
+\r
+$NetBSD$\r
+\r
+Doesn't compile with clang.\r
+\r
+--- lib/notmuch-private.h.orig 2013-08-03 11:29:40.000000000 +0000\r
++++ lib/notmuch-private.h\r
+@@ -64,7 +64,7 @@ NOTMUCH_BEGIN_DECLS\r
+ #define unused(x) x __attribute__ ((unused))\r
+ \r
+ #ifdef __cplusplus\r
+-# define visible __attribute__((visibility("default")))\r
++# define visible\r
+ #else\r
+ # define visible\r
+ #endif\r
+\r
+--cNdxnHkX5QqsyA0e--\r