[PATCH] configure: add --without-api-docs option
[notmuch-archives.git] / 6c / 159e7a6470e43596e92ede4b8a19a7cda0f301
1 Return-Path: <djcb@djcbsoftware.nl>\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 AE162431FBD\r
6         for <notmuch@notmuchmail.org>; Tue,  1 Dec 2009 10:50:44 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id Ix-vv4952uoK for <notmuch@notmuchmail.org>;\r
11         Tue,  1 Dec 2009 10:50:43 -0800 (PST)\r
12 Received: from gw01.mail.saunalahti.fi (gw01.mail.saunalahti.fi\r
13         [195.197.172.115])\r
14         by olra.theworths.org (Postfix) with ESMTP id 1A339431FBC\r
15         for <notmuch@notmuchmail.org>; Tue,  1 Dec 2009 10:50:43 -0800 (PST)\r
16 Received: from djcbsoftware.nl (a88-112-254-208.elisa-laajakaista.fi\r
17         [88.112.254.208])\r
18         (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by gw01.mail.saunalahti.fi (Postfix) with ESMTP id B5C54151688;\r
21         Tue,  1 Dec 2009 20:50:39 +0200 (EET)\r
22 Received: from cthulhu.mindcrime.djcbsoftware.nl (localhost [127.0.0.1])\r
23         by djcbsoftware.nl (Postfix) with ESMTP id 3044039C464;\r
24         Tue,  1 Dec 2009 20:50:03 +0200 (EET)\r
25 Date: Tue, 01 Dec 2009 20:50:03 +0200\r
26 Message-ID: <87638qbkbo.wl%djcb@djcbsoftware.nl>\r
27 From: Dirk-Jan C. Binnema <djcb.bulk@gmail.com>\r
28 To: Carl Worth <cworth@cworth.org>\r
29 In-Reply-To: <87k4x6ad94.fsf@yoom.home.cworth.org>\r
30 References: <87r5rpyd4x.wl%djcb@djcbsoftware.nl>\r
31         <87k4x6ad94.fsf@yoom.home.cworth.org>\r
32 Mail-Reply-To: djcb@djcbsoftware.nl\r
33 User-Agent: Wanderlust/2.15.6 (Almost Unreal) Emacs/23.1 Mule/6.0\r
34         (HANACHIRUSATO)\r
35 Organization: DJCBSoftware\r
36 MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka")\r
37 Content-Type: multipart/mixed; boundary="Multipart_Tue_Dec__1_20:50:03_2009-1"\r
38 Content-Transfer-Encoding: 7bit\r
39 Cc: "notmuch@notmuchmail org" <notmuch@notmuchmail.org>\r
40 Subject: Re: [notmuch] [PATCH 2/2] * avoid gcc 4.4.1 compiler warning due to\r
41         ignored 'fflush' return value\r
42 X-BeenThere: notmuch@notmuchmail.org\r
43 X-Mailman-Version: 2.1.12\r
44 Precedence: list\r
45 Reply-To: djcb@djcbsoftware.nl\r
46 List-Id: "Use and development of the notmuch mail system."\r
47         <notmuch.notmuchmail.org>\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
51 List-Post: <mailto:notmuch@notmuchmail.org>\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
55 X-List-Received-Date: Tue, 01 Dec 2009 18:50:44 -0000\r
56 \r
57 --Multipart_Tue_Dec__1_20:50:03_2009-1\r
58 Content-Type: text/plain; charset=US-ASCII\r
59 \r
60 Hi Carl,\r
61 \r
62 >>>>> "Carl" == Carl Worth <cworth@cworth.org> writes:\r
63 \r
64     Carl> [1  <text/plain (quoted-printable)>]\r
65     Carl> On Mon, 23 Nov 2009 08:21:50 +0200, Dirk-Jan C. Binnema <djcb.bulk@gmail.com> wrote:\r
66     >> -#define prompt(format, ...)                             \\r
67     >> -    do {                                                \\r
68     >> -        printf (format, ##__VA_ARGS__);                 \\r
69     >> -        fflush (stdout);                                \\r
70     >> -        getline (&response, &response_size, stdin);     \\r
71     >> -        chomp_newline (response);                       \\r
72     >> +#define prompt(format, ...)                                     \\r
73     >> +    do {                                                        \\r
74     >> +        int ignored;                                            \\r
75     >> +        printf (format, ##__VA_ARGS__);                         \\r
76     >> +        fflush (stdout);                                        \\r
77     >> +        ignored = getline (&response, &response_size, stdin);   \\r
78     >> +        chomp_newline (response);                               \\r
79     >> } while (0)\r
80 \r
81     Carl> This patch is incorrect. Ignoring the return value of getline results in\r
82     Carl> the program invoking undefined behavior by reading uninitialized\r
83     Carl> memory. This is easily tested by, for example, typing Control-D to\r
84     Carl> provide EOF to a prompt from "notmuch setup".\r
85 \r
86     Carl> How about just exiting in case of EOF as in the patch below?\r
87 \r
88 Sure, that's the better solution, but note that my patch did not introduce the\r
89 undefined behavior -- it was there before. I was trying a minimal patch to\r
90 silencing the warning. Note that prompt seems to leak a bit, even after the\r
91 committed patch; attached are two more micro patches to fix this and another\r
92 small leak. I try to do minimal changes, but the prompt business gets a bit\r
93 unwieldy. The leaks are one-time at not critical, but anyway it's always good\r
94 stay vigilant.\r
95 \r
96 \r
97 --Multipart_Tue_Dec__1_20:50:03_2009-1\r
98 Content-Type: application/octet-stream; type=patch\r
99 Content-Disposition: attachment;\r
100  filename="0001-notmuch-config-fix-small-leak-from-g_key_file_to_dat.patch"\r
101 Content-Transfer-Encoding: 7bit\r
102 \r
103 ---\r
104  notmuch-config.c |    2 ++\r
105  1 files changed, 2 insertions(+), 0 deletions(-)\r
106 \r
107 diff --git a/notmuch-config.c b/notmuch-config.c\r
108 index fc65d6b..95430db 100644\r
109 --- a/notmuch-config.c\r
110 +++ b/notmuch-config.c\r
111 @@ -317,9 +317,11 @@ notmuch_config_save (notmuch_config_t *config)\r
112         fprintf (stderr, "Error saving configuration to %s: %s\n",\r
113                  config->filename, error->message);\r
114         g_error_free (error);\r
115 +       g_free (data);\r
116         return 1;\r
117      }\r
118  \r
119 +    g_free (data);\r
120      return 0;\r
121  }\r
122  \r
123 -- \r
124 1.6.3.3\r
125 \r
126 \r
127 --Multipart_Tue_Dec__1_20:50:03_2009-1\r
128 Content-Type: text/plain; charset=US-ASCII\r
129 \r
130 \r
131 \r
132 \r
133 --Multipart_Tue_Dec__1_20:50:03_2009-1\r
134 Content-Type: application/octet-stream; type=patch\r
135 Content-Disposition: attachment;\r
136  filename="0002-free-the-response-data-from-prompt.patch"\r
137 Content-Transfer-Encoding: 7bit\r
138 \r
139 ---\r
140  notmuch-setup.c |   15 +++++++++++++--\r
141  1 files changed, 13 insertions(+), 2 deletions(-)\r
142 \r
143 diff --git a/notmuch-setup.c b/notmuch-setup.c\r
144 index 622bbaa..293c852 100644\r
145 --- a/notmuch-setup.c\r
146 +++ b/notmuch-setup.c\r
147 @@ -119,12 +119,16 @@ notmuch_setup_command (unused (void *ctx),\r
148      prompt ("Your full name [%s]: ", notmuch_config_get_user_name (config));\r
149      if (strlen (response))\r
150         notmuch_config_set_user_name (config, response);\r
151 -\r
152 +    free (response);\r
153 +    response = NULL;\r
154 +    \r
155      prompt ("Your primary email address [%s]: ",\r
156             notmuch_config_get_user_primary_email (config));\r
157      if (strlen (response))\r
158         notmuch_config_set_user_primary_email (config, response);\r
159 -\r
160 +    free (response);\r
161 +    response = NULL;\r
162 +    \r
163      other_emails = g_ptr_array_new ();\r
164  \r
165      old_other_emails = notmuch_config_get_user_other_email (config,\r
166 @@ -136,12 +140,17 @@ notmuch_setup_command (unused (void *ctx),\r
167         else\r
168             g_ptr_array_add (other_emails, talloc_strdup (ctx,\r
169                                                          old_other_emails[i]));\r
170 +       free (response);\r
171 +       response = NULL;\r
172      }\r
173  \r
174      do {\r
175         prompt ("Additional email address [Press 'Enter' if none]: ");\r
176         if (strlen (response))\r
177             g_ptr_array_add (other_emails, talloc_strdup (ctx, response));\r
178 +       free (response);\r
179 +       response = NULL;\r
180 +       \r
181      } while (strlen (response));\r
182      if (other_emails->len)\r
183         notmuch_config_set_user_other_email (config,\r
184 @@ -158,6 +167,8 @@ notmuch_setup_command (unused (void *ctx),\r
185         absolute_path = make_path_absolute (ctx, response);\r
186         notmuch_config_set_database_path (config, absolute_path);\r
187      }\r
188 +    free (response);\r
189 +    response = NULL;\r
190  \r
191      if (! notmuch_config_save (config)) {\r
192         if (is_new)\r
193 -- \r
194 1.6.3.3\r
195 \r
196 \r
197 --Multipart_Tue_Dec__1_20:50:03_2009-1\r
198 Content-Type: text/plain; charset=US-ASCII\r
199 \r
200 \r
201 \r
202 \r
203 Best wishes,\r
204 Dirk.\r
205 \r
206 -- \r
207 Dirk-Jan C. Binnema                  Helsinki, Finland\r
208 e:djcb@djcbsoftware.nl           w:www.djcbsoftware.nl\r
209 pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C\r
210 \r
211 \r
212 --Multipart_Tue_Dec__1_20:50:03_2009-1--\r