Re: [PATCH v4 08/16] reorganize indexing of multipart/signed and multipart/encrypted
[notmuch-archives.git] / 1c / aa7420959f69b59c0cd911c33a1863e60f1a2c
1 Return-Path: <nils@dieweltistgarnichtso.net>\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 AB422431E62\r
6         for <notmuch@notmuchmail.org>; Tue, 10 Feb 2015 09:16:01 -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: 1.738\r
10 X-Spam-Level: *\r
11 X-Spam-Status: No, score=1.738 tagged_above=-999 required=5\r
12         tests=[DNS_FROM_AHBL_RHSBL=2.438, RCVD_IN_DNSWL_LOW=-0.7]\r
13         autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id WdbJwl8Nwlv1 for <notmuch@notmuchmail.org>;\r
17         Tue, 10 Feb 2015 09:15:58 -0800 (PST)\r
18 Received: from mail.tiggerswelt.net (mail.tiggerswelt.net [94.186.151.130])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 376F0431FC7\r
22         for <notmuch@notmuchmail.org>; Tue, 10 Feb 2015 09:15:58 -0800 (PST)\r
23 Received: from localhost (f055173025.adsl.alicedsl.de [78.55.173.25])\r
24         (using TLSv1 with cipher AES128-SHA (128/128 bits))\r
25         (No client certificate requested)\r
26         by mail.tiggerswelt.net (Postfix) with ESMTP id 3F3615750;\r
27         Tue, 10 Feb 2015 18:17:00 +0100 (CET)\r
28 From: Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net>\r
29 To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org\r
30 Subject: Re: bug report: Emacs notmuch-mode fails attachments with spaces\r
31 In-Reply-To: <m24mqu455x.fsf@guru.guru-group.fi>\r
32 References: <87twyurc78.fsf@dieweltistgarnichtso.net>\r
33         <m24mqu455x.fsf@guru.guru-group.fi>\r
34 User-Agent: Notmuch/0.18.2 (http://notmuchmail.org) Emacs/23.4.1\r
35         (i486-pc-linux-gnu)\r
36 Date: Tue, 10 Feb 2015 18:15:38 +0100\r
37 Message-ID: <8761b9pu11.fsf@dieweltistgarnichtso.net>\r
38 MIME-Version: 1.0\r
39 Content-Type: multipart/signed; boundary="=-=-=";\r
40         micalg=pgp-sha256; protocol="application/pgp-signature"\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Tue, 10 Feb 2015 17:16:01 -0000\r
54 \r
55 --=-=-=\r
56 Content-Type: text/plain; charset=utf-8\r
57 Content-Transfer-Encoding: quoted-printable\r
58 \r
59 Tomi Ollila <tomi.ollila@iki.fi> writes:\r
60 \r
61 > On Mon, Feb 09 2015, Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net>=\r
62  wrote:\r
63 >\r
64 >> Dear notmuch developers,\r
65 >>\r
66 >>\r
67 >> I use notmuch-mode for GNU Emacs for managing my email.\r
68 >>\r
69 >> I think I have found a bug in notmuch-mode: If I do =E2=80=9C.-v=E2=80=\r
70 =9D on the line =E2=80=9C[\r
71 >> 2015 _ Richtlinien.pdf: application/pdf ]=E2=80=9D, then notmuch will op=\r
72 en three\r
73 >> windows of zathura (the PDF viewer I use).\r
74 >>\r
75 >> It seems to me that someone here either forgot quoting or decided to\r
76 >> split filenames on spaces. I suggest that =E2=80=9C2015 _ Richtlinien.pd=\r
77 f:\r
78 >> application/pdf=E2=80=9D should be quoted in notmuch-show-view-part.\r
79 >>\r
80 >> Note that saving attachment (=E2=80=9C.-s=E2=80=9D, notmuch-show-save-pa=\r
81 rt) generally\r
82 >> works even if the attachment file names have spaces. In case it matters,\r
83 >> I normally use the rc(1) shell in Debian <http://tobold.org/article/rc>.\r
84 >\r
85 > This code handles the saving and displaying in question (quick look hop i\r
86 > am right :)\r
87 >\r
88 >    2282 (defun notmuch-show-save-part ()\r
89 >    2283   "Save the MIME part containing point to a file."\r
90 >    2284   (interactive)\r
91 >    2285   (notmuch-show-apply-to-current-part-handle #'mm-save-part))\r
92 >    2286=20\r
93 >    2287 (defun notmuch-show-view-part ()\r
94 >    2288   "View the MIME part containing point in an external viewer."\r
95 >    2289   (interactive)\r
96 >    2290   ;; Set mm-inlined-types to nil to force an external viewer\r
97 >    2291   (let ((mm-inlined-types nil))\r
98 >    2292     (notmuch-show-apply-to-current-part-handle #'mm-display-part)=\r
99 ))\r
100 >\r
101 > SO, there is 2 options:\r
102 >\r
103 > 1) mm executes save part correctly but not display part\r
104 \r
105 It seems I cannot investigate this with my knowledge, as =E2=80=9CM-x\r
106 find-function RET mm-display-part=E2=80=9D gives =E2=80=9CCan't find library\r
107 /usr/share/emacs/23.4/lisp/gnus/mm-decode.el=E2=80=9D. Any ideas?\r
108 \r
109 > 2) there is (shell) wrapper program executing zathura which cannot handle\r
110 >    arguments with spaces (there is plenty of examples of this!)\r
111 >\r
112 >\r
113 > You could try to check how th external processes are executed by executin=\r
114 g:\r
115 >\r
116 > strace -f -e trace=3Dprocess emacs -f notmuch\r
117 >\r
118 > (emacs on X is preferable in this case ;)\r
119 \r
120 Thank you for that suggestion. It seems that there does happen both some\r
121 (wrong) escaping and splitting at spaces. I can see the following trace:\r
122 \r
123 =2D-- snib ---\r
124 execve("/usr/bin/zathura", ["/usr/bin/zathura", "/tmp/emm.23178ut2/2015\\",=\r
125  "_\\", "Richtlinien.pdf"] [/* 51 vars */]) =3D 0\r
126 =2D-- snab ---\r
127 \r
128 Somewhat unusually, it is preceeded by an invocation of the shell:\r
129 \r
130 =2D-- sneb ---\r
131 execve("/usr/bin/rc", ["/usr/bin/rc", "-c", "/usr/bin/zathura /tmp/emm.2317=\r
132 8u"...], [/* 51 vars */] <unfinished ...>\r
133 =2D-- snob ---\r
134 \r
135 It seems to me that all of the following are true in this case:\r
136 \r
137 1. Emacs executes the user's default shell to start zathura.\r
138 \r
139 2. For this, Emacs escapes the filename.\r
140 \r
141 3. Emacs applies the wrong escaping to the filename. Note that single\r
142    quotes are interoperable between shells, while backslashes are not.\r
143 \r
144 4. The rc(1) shell splits on spaces, as it knows no backslash escaping.\r
145 \r
146 5. The shell executes zathura with three arguments, all bogus filenames.\r
147 \r
148 I cannot pinpoint where all this is happening, but I would suggest to\r
149 just execve() zathura with a single unescaped filename as its argument.\r
150 \r
151 Greetings,\r
152 =2D-=20\r
153 Nils Dagsson Moskopp // erlehmann\r
154 <http://dieweltistgarnichtso.net>\r
155 \r
156 --=-=-=\r
157 Content-Type: application/pgp-signature\r
158 \r
159 -----BEGIN PGP SIGNATURE-----\r
160 Version: GnuPG v1\r
161 \r
162 iF4EAREIAAYFAlTaPLsACgkQZGjbY/Ag5QmGRQEApr9FG6WpfkDUjLxhdGu4DbtG\r
163 dIoF/fSqfU4pSUlY7U0A/AoyfkDs8DrdvXekmBfBCGbIf04xv7a7o1CqFCU5EQtq\r
164 =hh19\r
165 -----END PGP SIGNATURE-----\r
166 --=-=-=--\r