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