Re: [PATCH] Fix typo in Message.maildir_flags_to_tags
[notmuch-archives.git] / 9e / 289ce7e9c6a20bc0eed2fdb95ac0b4df56ee4a
1 Return-Path: <wiz@danbala.ifoer.tuwien.ac.at>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 7E686431FBC\r
6         for <notmuch@notmuchmail.org>; Fri,  3 Jan 2014 13:53:51 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id iwjkVjClywfP for <notmuch@notmuchmail.org>;\r
16         Fri,  3 Jan 2014 13:53:42 -0800 (PST)\r
17 X-Greylist: delayed 361 seconds by postgrey-1.32 at olra;\r
18         Fri, 03 Jan 2014 13:53:42 PST\r
19 Received: from danbala.ifoer.tuwien.ac.at (danbala.ifoer.tuwien.ac.at\r
20         [128.130.168.64])\r
21         by olra.theworths.org (Postfix) with ESMTP id 898E8431FB6\r
22         for <notmuch@notmuchmail.org>; Fri,  3 Jan 2014 13:53:42 -0800 (PST)\r
23 Received: by danbala.ifoer.tuwien.ac.at (Postfix, from userid 116)\r
24         id 0665B390DAF; Fri,  3 Jan 2014 22:47:35 +0100 (CET)\r
25 Date: Fri, 3 Jan 2014 22:47:35 +0100\r
26 From: Thomas Klausner <tk@giga.or.at>\r
27 To: notmuch@notmuchmail.org\r
28 Subject: notmuch-0.16: realpath() compatibility issue; clang visibility\r
29  problem\r
30 Message-ID: <20140103214735.GG27614@danbala.tuwien.ac.at>\r
31 MIME-Version: 1.0\r
32 Content-Type: multipart/mixed; boundary="cNdxnHkX5QqsyA0e"\r
33 Content-Disposition: inline\r
34 X-Mailman-Approved-At: Sat, 04 Jan 2014 04:25:46 -0800\r
35 X-BeenThere: notmuch@notmuchmail.org\r
36 X-Mailman-Version: 2.1.13\r
37 Precedence: list\r
38 List-Id: "Use and development of the notmuch mail system."\r
39         <notmuch.notmuchmail.org>\r
40 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
41         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
43 List-Post: <mailto:notmuch@notmuchmail.org>\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
45 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
47 X-List-Received-Date: Fri, 03 Jan 2014 21:53:51 -0000\r
48 \r
49 \r
50 --cNdxnHkX5QqsyA0e\r
51 Content-Type: text/plain; charset=us-ascii\r
52 Content-Disposition: inline\r
53 \r
54 Hi!\r
55 \r
56 I'm currently starting to try out notmuch-0.16 on NetBSD. It went off\r
57 to a rocky start, since it segfaulted in the initial config setup.\r
58 \r
59 Debugging it I found that notmuch uses a glibc extension to realpath,\r
60 allowing NULL as second argument.\r
61 \r
62 I've converted it to use a prepared buffer instead; attached is a\r
63 possible patch that makes notmuch complete its setup phase for me, and\r
64 adds inclusion of the header files suggested by the realpath man page\r
65 on NetBSD. Please address this issue in some way in the next release.\r
66 \r
67 Additionally, when compiling with clang, there are issues with the\r
68 visibility. The symptoms are:\r
69 \r
70 In file included from lib/database.cc:21:\r
71 In file included from ./lib/database-private.h:33:\r
72 ./lib/notmuch-private.h:479:8: error: visibility does not match previous declaration\r
73 array subscriptstruct visible _notmuch_string_list {\r
74        ^\r
75 ./lib/notmuch-private.h:67:33: note: expanded from macro 'visible'\r
76  # define visible __attribute__((visibility("default")))\r
77                                 ^\r
78 ./lib/notmuch-private.h:52:13: note: previous attribute is here\r
79 #pragma GCC visibility push(hidden)\r
80             ^\r
81 \r
82 In file included from lib/parse-time-vrp.cc:23:\r
83 In file included from ./lib/database-private.h:33:\r
84 ./lib/notmuch-private.h:479:8: error: visibility does not match previous declaration\r
85 struct visible _notmuch_string_list {\r
86        ^\r
87 ./lib/notmuch-private.h:67:33: note: expanded from macro 'visible'\r
88 # define visible __attribute__((visibility("default")))\r
89                                 ^\r
90 ./lib/notmuch-private.h:52:13: note: previous attribute is here\r
91 #pragma GCC visibility push(hidden)\r
92             ^\r
93 1 warning generated.\r
94 In file included from lib/directory.cc:21:\r
95 ./lib/notmuch-private.h:479:8: error: visibility does not match previous declaration\r
96 struct visible _notmuch_string_list {\r
97        ^\r
98 ./lib/notmuch-private.h:67:33: note: expanded from macro 'visible'\r
99 # define visible __attribute__((visibility("default")))\r
100                                 ^\r
101 ./lib/notmuch-private.h:52:13: note: previous attribute is here\r
102 #pragma GCC visibility push(hidden)\r
103             ^\r
104 \r
105 and so on. I guess it is because the visibility differs between c and\r
106 c++. I've disabled visibility locally, see second attached patch, but\r
107 of course that's not a solution, just a workaround. Suggestions\r
108 welcome.\r
109 \r
110 Thanks,\r
111  Thomas\r
112 \r
113 --cNdxnHkX5QqsyA0e\r
114 Content-Type: text/plain; charset=us-ascii\r
115 Content-Disposition: attachment; filename="patch-notmuch-config.c"\r
116 \r
117 $NetBSD$\r
118 \r
119 NULL as second argument for realpath() is only supported in glibc.\r
120 Use more portable code.\r
121 \r
122 --- notmuch-config.c.orig       2013-08-03 11:29:40.000000000 +0000\r
123 +++ notmuch-config.c\r
124 @@ -23,6 +23,8 @@\r
125  #include <pwd.h>\r
126  #include <netdb.h>\r
127  #include <assert.h>\r
128 +#include <sys/param.h>\r
129 +#include <stdlib.h>\r
130  \r
131  static const char toplevel_config_comment[] =\r
132      " .notmuch-config - Configuration file for the notmuch mail system\n"\r
133 @@ -444,7 +446,7 @@ int\r
134  notmuch_config_save (notmuch_config_t *config)\r
135  {\r
136      size_t length;\r
137 -    char *data, *filename;\r
138 +    char *data, filename[MAXPATHLEN];\r
139      GError *error = NULL;\r
140  \r
141      data = g_key_file_to_data (config->key_file, &length, NULL);\r
142 @@ -454,15 +456,9 @@ notmuch_config_save (notmuch_config_t *c\r
143      }\r
144  \r
145      /* Try not to overwrite symlinks. */\r
146 -    filename = realpath (config->filename, NULL);\r
147 -    if (! filename) {\r
148 +    if (! realpath (config->filename, filename)) {\r
149         if (errno == ENOENT) {\r
150 -           filename = strdup (config->filename);\r
151 -           if (! filename) {\r
152 -               fprintf (stderr, "Out of memory.\n");\r
153 -               g_free (data);\r
154 -               return 1;\r
155 -           }\r
156 +           strcpy(filename, config->filename);\r
157         } else {\r
158             fprintf (stderr, "Error canonicalizing %s: %s\n", config->filename,\r
159                      strerror (errno));\r
160 @@ -480,12 +476,10 @@ notmuch_config_save (notmuch_config_t *c\r
161                      filename, error->message);\r
162         }\r
163         g_error_free (error);\r
164 -       free (filename);\r
165         g_free (data);\r
166         return 1;\r
167      }\r
168  \r
169 -    free (filename);\r
170      g_free (data);\r
171      return 0;\r
172  }\r
173 \r
174 --cNdxnHkX5QqsyA0e\r
175 Content-Type: text/plain; charset=us-ascii\r
176 Content-Disposition: attachment; filename="patch-lib_notmuch-private.h"\r
177 \r
178 $NetBSD$\r
179 \r
180 Doesn't compile with clang.\r
181 \r
182 --- lib/notmuch-private.h.orig  2013-08-03 11:29:40.000000000 +0000\r
183 +++ lib/notmuch-private.h\r
184 @@ -64,7 +64,7 @@ NOTMUCH_BEGIN_DECLS\r
185  #define unused(x) x __attribute__ ((unused))\r
186  \r
187  #ifdef __cplusplus\r
188 -# define visible __attribute__((visibility("default")))\r
189 +# define visible\r
190  #else\r
191  # define visible\r
192  #endif\r
193 \r
194 --cNdxnHkX5QqsyA0e--\r