From: Thomas Klausner <tk@giga.or.at>
To: notmuch@notmuchmail.org
Subject: notmuch-0.16: realpath() compatibility issue; clang visibility problem
Date: Fri, 3 Jan 2014 22:47:35 +0100 [thread overview]
Message-ID: <20140103214735.GG27614@danbala.tuwien.ac.at> (raw)
[-- Attachment #1: Type: text/plain, Size: 2337 bytes --]
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
[-- Attachment #2: patch-notmuch-config.c --]
[-- Type: text/plain, Size: 1497 bytes --]
$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 <pwd.h>
#include <netdb.h>
#include <assert.h>
+#include <sys/param.h>
+#include <stdlib.h>
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;
}
[-- Attachment #3: patch-lib_notmuch-private.h --]
[-- Type: text/plain, Size: 346 bytes --]
$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
next reply other threads:[~2014-01-03 21:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-03 21:47 Thomas Klausner [this message]
2014-01-04 12:35 ` notmuch-0.16: realpath() compatibility issue; clang visibility problem Jani Nikula
2014-01-04 12:46 ` Jani Nikula
2014-01-04 12:53 ` Thomas Klausner
2014-01-04 13:06 ` Tomi Ollila
2014-01-04 13:28 ` Thomas Klausner
2014-01-04 12:52 ` Thomas Klausner
2014-01-04 13:18 ` David Bremner
2014-01-04 22:37 ` Thomas Klausner
2014-01-04 22:53 ` Jani Nikula
2014-04-08 11:26 ` David Bremner
[not found] ` <20140408123312.GZ5053@danbala.tuwien.ac.at>
2014-06-26 12:02 ` David Bremner
2014-06-26 12:52 ` David Bremner
2014-06-26 13:08 ` notmuch-0.18 issues [was Re: notmuch-0.16: realpath() compatibility issue; clang visibility problem] Thomas Klausner
2014-06-26 13:16 ` Tomi Ollila
2014-06-26 15:00 ` David Bremner
2017-03-12 16:21 ` David Bremner
2017-03-12 17:24 ` Tomi Ollila
2017-03-12 20:52 ` Thomas Klausner
2017-03-12 16:00 ` notmuch-0.16: realpath() compatibility issue; clang visibility problem David Bremner
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
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140103214735.GG27614@danbala.tuwien.ac.at \
--to=tk@giga.or.at \
--cc=notmuch@notmuchmail.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.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).