[PATCH v2 6/9] test/basic: use portable args for find
[notmuch-archives.git] / b7 / 2ee9e4af8f20c0743382860d96aaa22d0625fc
1 Return-Path: <darren@fernseed.info>\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 2BD89429E21\r
6         for <notmuch@notmuchmail.org>; Fri, 25 Nov 2011 12:37:23 -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.1\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.1 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1] 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 KVfTYtGBTkMO for <notmuch@notmuchmail.org>;\r
16         Fri, 25 Nov 2011 12:37:21 -0800 (PST)\r
17 Received: from silentio.fernseed.info (silentio.fernseed.info [217.169.4.202])\r
18         (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 513DC431FB6\r
21         for <notmuch@notmuchmail.org>; Fri, 25 Nov 2011 12:37:21 -0800 (PST)\r
22 Received: from localhost (bookbinder.fernseed.info\r
23         [IPv6:2001:8b0:ff94:1:224:2cff:fe37:838b])\r
24         (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
25         (Client did not present a certificate) (Authenticated sender: darren)\r
26         by silentio.fernseed.info (Postfix) with ESMTPSA id 6812D98;\r
27         Fri, 25 Nov 2011 20:37:16 +0000 (GMT)\r
28 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fernseed.info;\r
29         s=default; t=1322253439;\r
30         bh=pcrolySvIqSt9MzCMA2dFeSReAhfFU6EZVw9iT2Nnok=;\r
31         h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:\r
32         MIME-Version:Content-Type;\r
33         b=Q+mcg76t/xsma4maJeg41VyTt1BWQ/aNVIojvAvGC6JWexrMbuHFwKrj8WyUE7Fn2\r
34         WJnifWRmEG89uE/HJmnoUnlUHOuxix8ZLQ/p0MT5maw/Hpvv8fa9/ZvuNpeoxdtiJv\r
35         NLt18hGfIR0gIaC+Ub8Ap3XFk/dSUFbV+S0lh5+g=\r
36 From: Darren McGuicken <mailing-notmuch@fernseed.info>\r
37 To: David Bremner <david@tethera.net>,\r
38         Jameson Graef Rollins <jrollins@finestructure.net>,\r
39         Dirk Hohndel <hohndel@infradead.org>,\r
40         Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
41 Subject: Re: compile error of current git on F15\r
42 In-Reply-To: <87ehwwvy94.fsf@rocinante.cs.unb.ca>\r
43 References: <m3d3j1uz2i.fsf@x201s.gr8dns.org>\r
44         <8762osjagp.fsf@servo.factory.finestructure.net>\r
45         <4DE51768.3070409@fifthhorseman.net>\r
46         <m3ipspbuge.fsf@x201s.gr8dns.org>\r
47         <87oc2hlcej.fsf@servo.factory.finestructure.net>\r
48         <87y5v5i49b.fsf@bookbinder.fernseed.info>\r
49         <87ehwwvy94.fsf@rocinante.cs.unb.ca>\r
50 User-Agent: Notmuch/0.10 (http://notmuchmail.org) Emacs/23.3.1\r
51         (i386-redhat-linux-gnu)\r
52 Date: Fri, 25 Nov 2011 20:37:14 +0000\r
53 Message-ID: <8762i8hrb9.fsf@bookbinder.fernseed.info>\r
54 MIME-Version: 1.0\r
55 Content-Type: multipart/signed; boundary="==-=-=";\r
56         micalg=pgp-sha1; protocol="application/pgp-signature"\r
57 Cc: notmuch <notmuch@notmuchmail.org>, Jeffrey Stedfast <fejj@novell.com>\r
58 X-BeenThere: notmuch@notmuchmail.org\r
59 X-Mailman-Version: 2.1.13\r
60 Precedence: list\r
61 List-Id: "Use and development of the notmuch mail system."\r
62         <notmuch.notmuchmail.org>\r
63 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
65 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
66 List-Post: <mailto:notmuch@notmuchmail.org>\r
67 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
68 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
69         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
70 X-List-Received-Date: Fri, 25 Nov 2011 20:37:23 -0000\r
71 \r
72 --==-=-=\r
73 Content-Type: multipart/mixed; boundary="=-=-="\r
74 \r
75 --=-=-=\r
76 Content-Type: text/plain; charset=utf-8\r
77 Content-Transfer-Encoding: quoted-printable\r
78 \r
79 On Fri, 25 Nov 2011 13:43:35 -0500, David Bremner <david@tethera.net> wrote:\r
80 > Just confirm, all the crypto tests pass with this patch? In that case,\r
81 > can we have the patch (preferably as generated by git-send-email)? Or\r
82 > did I miss it somewhere in this thread?\r
83 \r
84 I don't believe the patch ever made it to the list, I can't find it in\r
85 my own archive.  From the changelog here:\r
86 \r
87   http://koji.fedoraproject.org/koji/buildinfo?buildID=3D269819\r
88 \r
89   it looks like Karel Kl=C3=AD=C4=8D of Red Hat created it back in July, I =\r
90 assume\r
91 that's when Fedora moved to the later GMime version.\r
92 \r
93 The patch itself looks like it's a straight re-mapping of the 2.4\r
94 GMimeSignatureValidity to the 2.5+ equivalent along with some\r
95 deprecation of GMimeSession, so just applying the patch will break\r
96 compilation for anyone < 2.5.\r
97 \r
98 Also, three of the crypto tests relating to signature validation /do/\r
99 fail, although it looks like that may simply be down to changes in the\r
100 output format and so just need updated test cases.\r
101 \r
102 I've attached the patch as-is to this mail for reference purposes, but\r
103 based on the above it'll need a bit of tweaking before it's useful to\r
104 the wider group.\r
105 \r
106 \r
107 --=-=-=\r
108 Content-Type: text/x-patch\r
109 Content-Disposition: attachment; filename=notmuch-0.6.1-gmime.patch\r
110 Content-Transfer-Encoding: quoted-printable\r
111 Content-Description: Fedora GMime Patch\r
112 \r
113 diff -up notmuch-0.6.1/notmuch-client.h.gmime notmuch-0.6.1/notmuch-client.h\r
114 =2D-- notmuch-0.6.1/notmuch-client.h.gmime      2011-07-17 16:20:51.000000000 +0=\r
115 200\r
116 +++ notmuch-0.6.1/notmuch-client.h      2011-07-28 17:24:16.904949635 +0200\r
117 @@ -68,7 +68,7 @@ typedef struct notmuch_show_format {\r
118      void (*part_start) (GMimeObject *part,\r
119                         int *part_count);\r
120      void (*part_encstatus) (int status);\r
121 =2D    void (*part_sigstatus) (const GMimeSignatureValidity* validity);\r
122 +    void (*part_sigstatus) (GMimeSignatureList *siglist);\r
123      void (*part_content) (GMimeObject *part);\r
124      void (*part_end) (GMimeObject *part);\r
125      const char *part_sep;\r
126 @@ -82,7 +82,7 @@ typedef struct notmuch_show_params {\r
127      int entire_thread;\r
128      int raw;\r
129      int part;\r
130 =2D    GMimeCipherContext* cryptoctx;\r
131 +    GMimeCryptoContext* cryptoctx;\r
132      int decrypt;\r
133  } notmuch_show_params_t;\r
134 =20\r
135 diff -up notmuch-0.6.1/notmuch-reply.c.gmime notmuch-0.6.1/notmuch-reply.c\r
136 =2D-- notmuch-0.6.1/notmuch-reply.c.gmime       2011-07-17 16:20:51.000000000 +02=\r
137 00\r
138 +++ notmuch-0.6.1/notmuch-reply.c       2011-07-28 17:24:16.904949635 +0200\r
139 @@ -610,13 +610,10 @@ notmuch_reply_command (void *ctx, int ar\r
140             }\r
141         } else if ((STRNCMP_LITERAL (argv[i], "--decrypt") =3D=3D 0)) {\r
142             if (params.cryptoctx =3D=3D NULL) {\r
143 =2D             GMimeSession* session =3D g_object_new(g_mime_session_get_type(), NULL=\r
144 );\r
145 =2D             if (NULL =3D=3D (params.cryptoctx =3D g_mime_gpg_context_new(session, =\r
146 "gpg")))\r
147 +               if (NULL =3D=3D (params.cryptoctx =3D g_mime_gpg_context_new(NULL, "gpg"=\r
148 )))\r
149                     fprintf (stderr, "Failed to construct gpg context.\n");\r
150                 else\r
151                     g_mime_gpg_context_set_always_trust((GMimeGpgContext*)params.cryptoc=\r
152 tx, FALSE);\r
153 =2D             g_object_unref (session);\r
154 =2D             session =3D NULL;\r
155             }\r
156         } else {\r
157             fprintf (stderr, "Unrecognized option: %s\n", argv[i]);\r
158 diff -up notmuch-0.6.1/notmuch-show.c.gmime notmuch-0.6.1/notmuch-show.c\r
159 =2D-- notmuch-0.6.1/notmuch-show.c.gmime        2011-07-17 16:20:51.000000000 +0200\r
160 +++ notmuch-0.6.1/notmuch-show.c        2011-07-28 17:24:16.905949620 +0200\r
161 @@ -70,7 +70,7 @@ static void\r
162  format_part_encstatus_json (int status);\r
163 =20\r
164  static void\r
165 =2Dformat_part_sigstatus_json (const GMimeSignatureValidity* validity);\r
166 +format_part_sigstatus_json (GMimeSignatureList *siglist);\r
167 =20\r
168  static void\r
169  format_part_content_json (GMimeObject *part);\r
170 @@ -420,16 +420,14 @@ show_text_part_content (GMimeObject *par\r
171  }\r
172 =20\r
173  static const char*\r
174 =2Dsigner_status_to_string (GMimeSignerStatus x)\r
175 +signature_status_to_string (GMimeSignatureStatus x)\r
176  {\r
177      switch (x) {\r
178 =2D    case GMIME_SIGNER_STATUS_NONE:\r
179 =2D     return "none";\r
180 =2D    case GMIME_SIGNER_STATUS_GOOD:\r
181 +    case GMIME_SIGNATURE_STATUS_GOOD:\r
182         return "good";\r
183 =2D    case GMIME_SIGNER_STATUS_BAD:\r
184 +    case GMIME_SIGNATURE_STATUS_BAD:\r
185         return "bad";\r
186 =2D    case GMIME_SIGNER_STATUS_ERROR:\r
187 +    case GMIME_SIGNATURE_STATUS_ERROR:\r
188         return "error";\r
189      }\r
190      return "unknown";\r
191 @@ -524,59 +522,65 @@ format_part_encstatus_json (int status)\r
192  }\r
193 =20\r
194  static void\r
195 =2Dformat_part_sigstatus_json (const GMimeSignatureValidity* validity)\r
196 +format_part_sigstatus_json (GMimeSignatureList *siglist)\r
197  {\r
198      printf (", \"sigstatus\": [");\r
199 =20\r
200 =2D    if (!validity) {\r
201 +    if (!siglist) {\r
202         printf ("]");\r
203         return;\r
204      }\r
205 =20\r
206 =2D    const GMimeSigner *signer =3D g_mime_signature_validity_get_signers =\r
207 (validity);\r
208 =2D    int first =3D 1;\r
209      void *ctx_quote =3D talloc_new (NULL);\r
210 +    int i;\r
211 +    for (i =3D 0; i < g_mime_signature_list_length (siglist); ++i) {\r
212 +       GMimeSignature *signature =3D g_mime_signature_list_get_signature (siglis=\r
213 t, i);\r
214 =20\r
215 =2D    while (signer) {\r
216 =2D     if (first)\r
217 =2D         first =3D 0;\r
218 =2D     else\r
219 +       if (i > 0)\r
220             printf (", ");\r
221 =2D\r
222         printf ("{");\r
223 =20\r
224         /* status */\r
225 +       GMimeSignatureStatus status =3D g_mime_signature_get_status (signature);\r
226         printf ("\"status\": %s",\r
227                 json_quote_str (ctx_quote,\r
228 =2D                             signer_status_to_string (signer->status)));\r
229 +                               signature_status_to_string (status)));\r
230 =20\r
231 =2D     if (signer->status =3D=3D GMIME_SIGNER_STATUS_GOOD)\r
232 +       GMimeCertificate *certificate =3D g_mime_signature_get_certificate (signa=\r
233 ture);\r
234 +       if (status =3D=3D GMIME_SIGNATURE_STATUS_GOOD)\r
235         {\r
236 =2D         if (signer->fingerprint)\r
237 =2D             printf (", \"fingerprint\": %s", json_quote_str (ctx_quote, signer->fi=\r
238 ngerprint));\r
239 +           if (certificate)\r
240 +               printf (", \"fingerprint\": %s", json_quote_str (ctx_quote, g_mime_certi=\r
241 ficate_get_fingerprint (certificate)));\r
242             /* these dates are seconds since the epoch; should we\r
243              * provide a more human-readable format string? */\r
244 =2D         if (signer->created)\r
245 =2D             printf (", \"created\": %d", (int) signer->created);\r
246 =2D         if (signer->expires)\r
247 =2D             printf (", \"expires\": %d", (int) signer->expires);\r
248 +           time_t created =3D g_mime_signature_get_created (signature);\r
249 +           if (created !=3D -1)\r
250 +               printf (", \"created\": %d", (int) created);\r
251 +           time_t expires =3D g_mime_signature_get_expires (signature);\r
252 +           if (expires !=3D -1)\r
253 +               printf (", \"expires\": %d", (int) expires);\r
254             /* output user id only if validity is FULL or ULTIMATE. */\r
255             /* note that gmime is using the term "trust" here, which\r
256              * is WRONG.  It's actually user id "validity". */\r
257 =2D         if ((signer->name) && (signer->trust)) {\r
258 =2D             if ((signer->trust =3D=3D GMIME_SIGNER_TRUST_FULLY) || (signer->trust =\r
259 =3D=3D GMIME_SIGNER_TRUST_ULTIMATE))\r
260 =2D                 printf (", \"userid\": %s", json_quote_str (ctx_quote, signer->nam=\r
261 e));\r
262 +           if (certificate)\r
263 +           {\r
264 +               const char *name =3D g_mime_certificate_get_issuer_name (certificate);\r
265 +               GMimeCertificateTrust trust =3D g_mime_certificate_get_trust (certificat=\r
266 e);\r
267 +               if (name && (trust =3D=3D GMIME_CERTIFICATE_TRUST_FULLY || trust =3D=3D =\r
268 GMIME_CERTIFICATE_TRUST_ULTIMATE))\r
269 +                   printf (", \"userid\": %s", json_quote_str (ctx_quote, name));\r
270             }\r
271 =2D       } else {\r
272 =2D           if (signer->keyid)\r
273 =2D               printf (", \"keyid\": %s", json_quote_str (ctx_quote, sig=\r
274 ner->keyid));\r
275 =2D       }\r
276 =2D       if (signer->errors !=3D GMIME_SIGNER_ERROR_NONE) {\r
277 =2D           printf (", \"errors\": %x", signer->errors);\r
278 =2D       }\r
279 +       } else if (certificate) {\r
280 +           const char *key_id =3D g_mime_certificate_get_key_id (certificate);\r
281 +           if (key_id)\r
282 +               printf (", \"keyid\": %s", json_quote_str (ctx_quote, key_id));\r
283 +       }\r
284 +\r
285 +       GMimeSignatureError errors =3D g_mime_signature_get_errors (signature);\r
286 +       if (errors !=3D GMIME_SIGNATURE_ERROR_NONE) {\r
287 +           printf (", \"errors\": %x", errors);\r
288 +       }\r
289 =20\r
290 =2D       printf ("}");\r
291 =2D       signer =3D signer->next;\r
292 +       printf ("}");\r
293      }\r
294 =20\r
295      printf ("]");\r
296 @@ -899,13 +903,10 @@ notmuch_show_command (void *ctx, unused=20\r
297         } else if ((STRNCMP_LITERAL (argv[i], "--verify") =3D=3D 0) ||\r
298                    (STRNCMP_LITERAL (argv[i], "--decrypt") =3D=3D 0)) {\r
299             if (params.cryptoctx =3D=3D NULL) {\r
300 =2D             GMimeSession* session =3D g_object_new(g_mime_session_get_type(), NULL=\r
301 );\r
302 =2D             if (NULL =3D=3D (params.cryptoctx =3D g_mime_gpg_context_new(session, =\r
303 "gpg")))\r
304 +               if (NULL =3D=3D (params.cryptoctx =3D g_mime_gpg_context_new(NULL, "gpg"=\r
305 )))\r
306                     fprintf (stderr, "Failed to construct gpg context.\n");\r
307                 else\r
308                     g_mime_gpg_context_set_always_trust((GMimeGpgContext*)params.cryptoc=\r
309 tx, FALSE);\r
310 =2D             g_object_unref (session);\r
311 =2D             session =3D NULL;\r
312             }\r
313             if (STRNCMP_LITERAL (argv[i], "--decrypt") =3D=3D 0)\r
314                 params.decrypt =3D 1;\r
315 diff -up notmuch-0.6.1/show-message.c.gmime notmuch-0.6.1/show-message.c\r
316 =2D-- notmuch-0.6.1/show-message.c.gmime        2011-07-17 16:20:51.000000000 +0200\r
317 +++ notmuch-0.6.1/show-message.c        2011-07-28 17:27:12.295304742 +0200\r
318 @@ -68,15 +68,16 @@ show_message_part (GMimeObject *part,\r
319                          g_mime_multipart_get_count (multipart));\r
320             } else {\r
321                 GMimeMultipartEncrypted *encrypteddata =3D GMIME_MULTIPART_ENCRYPTED (pa=\r
322 rt);\r
323 =2D             decryptedpart =3D g_mime_multipart_encrypted_decrypt (encrypteddata, p=\r
324 arams->cryptoctx, &err);\r
325 +               GMimeDecryptResult *decrypt_result =3D g_mime_decrypt_result_new ();\r
326 +               decryptedpart =3D g_mime_multipart_encrypted_decrypt (encrypteddata, par=\r
327 ams->cryptoctx, &decrypt_result, &err);\r
328                 if (decryptedpart) {\r
329                     if ((selected || state->in_zone) && format->part_encstatus)\r
330                         format->part_encstatus (1);\r
331 =2D                 const GMimeSignatureValidity *sigvalidity =3D g_mime_multipart_enc=\r
332 rypted_get_signature_validity (encrypteddata);\r
333 =2D                 if (!sigvalidity)\r
334 =2D                     fprintf (stderr, "Failed to verify signed part: %s\n", (err ? err->me=\r
335 ssage : "no error explanation given"));\r
336 +                   GMimeSignatureList *siglist =3D g_mime_decrypt_result_get_signatures=\r
337  (decrypt_result);\r
338 +                   if (!siglist)\r
339 +                       fprintf (stderr, "Failed to get signatures: %s\n", (err ? err->message =\r
340 : "no error explanation given"));\r
341                     if ((selected || state->in_zone) && format->part_sigstatus)\r
342 =2D                     format->part_sigstatus (sigvalidity);\r
343 +                       format->part_sigstatus (siglist);\r
344                 } else {\r
345                     fprintf (stderr, "Failed to decrypt part: %s\n", (err ? err->message=\r
346  : "no error explanation given"));\r
347                     if ((selected || state->in_zone) && format->part_encstatus)\r
348 @@ -92,20 +93,14 @@ show_message_part (GMimeObject *part,\r
349                          "Error: %d part(s) for a multipart/signed message (should be exactly 2=\r
350 )\n",\r
351                          g_mime_multipart_get_count (multipart));\r
352             } else {\r
353 =2D             /* For some reason the GMimeSignatureValidity returned\r
354 =2D              * here is not a const (inconsistent with that\r
355 =2D              * returned by\r
356 =2D              * g_mime_multipart_encrypted_get_signature_validity,\r
357 =2D              * and therefore needs to be properly disposed of.\r
358 =2D              * Hopefully the API will become more consistent. */\r
359 =2D             GMimeSignatureValidity *sigvalidity =3D g_mime_multipart_signed_verify=\r
360  (GMIME_MULTIPART_SIGNED (part), params->cryptoctx, &err);\r
361 =2D             if (!sigvalidity) {\r
362 +               GMimeSignatureList *siglist =3D g_mime_multipart_signed_verify (GMIME_MU=\r
363 LTIPART_SIGNED (part), params->cryptoctx, &err);\r
364 +               if (!siglist) {\r
365                     fprintf (stderr, "Failed to verify signed part: %s\n", (err ? err->m=\r
366 essage : "no error explanation given"));\r
367                 }\r
368                 if ((selected || state->in_zone) && format->part_sigstatus)\r
369 =2D                 format->part_sigstatus (sigvalidity);\r
370 =2D             if (sigvalidity)\r
371 =2D                 g_mime_signature_validity_free (sigvalidity);\r
372 +                   format->part_sigstatus (siglist);\r
373 +               if (siglist)\r
374 +                   g_object_unref (siglist);\r
375             }\r
376         }\r
377 =20\r
378 \r
379 --=-=-=--\r
380 \r
381 --==-=-=\r
382 Content-Type: application/pgp-signature\r
383 \r
384 -----BEGIN PGP SIGNATURE-----\r
385 Version: GnuPG v1.4.11 (GNU/Linux)\r
386 \r
387 iEYEARECAAYFAk7P/HsACgkQP1ao/7snsT4jeACfTnClmksLfTAA86htzmrAeUWb\r
388 JHQAoK69Uqh3KGO7pgGLl+jtglyVTHD6\r
389 =Gs0G\r
390 -----END PGP SIGNATURE-----\r
391 --==-=-=--\r