Re: [PATCH v4 13/16] add indexopts to notmuch python bindings.
[notmuch-archives.git] / e4 / 9ab3d63d9dc191028848fd48266a6346ce9c4e
1 Return-Path: <tomi.ollila@iki.fi>\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 4BD22431FBD\r
6         for <notmuch@notmuchmail.org>; Wed, 11 Feb 2015 04:28:37 -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: 2.438\r
10 X-Spam-Level: **\r
11 X-Spam-Status: No, score=2.438 tagged_above=-999 required=5\r
12         tests=[DNS_FROM_AHBL_RHSBL=2.438] 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 CNpfQI4VJD81 for <notmuch@notmuchmail.org>;\r
16         Wed, 11 Feb 2015 04:28:31 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 569B5431FB6\r
19         for <notmuch@notmuchmail.org>; Wed, 11 Feb 2015 04:28:31 -0800 (PST)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id 3A40D100086;\r
22         Wed, 11 Feb 2015 14:28:04 +0200 (EET)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net>,\r
25         notmuch@notmuchmail.org\r
26 Subject: Re: bug report: Emacs notmuch-mode fails attachments with spaces\r
27 In-Reply-To: <8761b9pu11.fsf@dieweltistgarnichtso.net>\r
28 References: <87twyurc78.fsf@dieweltistgarnichtso.net>\r
29         <m24mqu455x.fsf@guru.guru-group.fi>\r
30         <8761b9pu11.fsf@dieweltistgarnichtso.net>\r
31 User-Agent: Notmuch/0.19+53~gb45d2f9 (http://notmuchmail.org) Emacs/24.3.1\r
32         (x86_64-unknown-linux-gnu)\r
33 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
34         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
35         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
36 Date: Wed, 11 Feb 2015 14:28:03 +0200\r
37 Message-ID: <m24mqs63ak.fsf@guru.guru-group.fi>\r
38 MIME-Version: 1.0\r
39 Content-Type: text/plain; charset=utf-8\r
40 Content-Transfer-Encoding: quoted-printable\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: Wed, 11 Feb 2015 12:28:37 -0000\r
54 \r
55 On Tue, Feb 10 2015, Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net> w=\r
56 rote:\r
57 \r
58 > Tomi Ollila <tomi.ollila@iki.fi> writes:\r
59 >\r
60 >> On Mon, Feb 09 2015, Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net=\r
61 > wrote:\r
62 >>\r
63 >>> Dear notmuch developers,\r
64 >>>\r
65 >>>\r
66 >>> I use notmuch-mode for GNU Emacs for managing my email.\r
67 >>>\r
68 >>> I think I have found a bug in notmuch-mode: If I do =E2=80=9C.-v=E2=80=\r
69 =9D on the line =E2=80=9C[\r
70 >>> 2015 _ Richtlinien.pdf: application/pdf ]=E2=80=9D, then notmuch will o=\r
71 pen three\r
72 >>> windows of zathura (the PDF viewer I use).\r
73 >>>\r
74 >>> It seems to me that someone here either forgot quoting or decided to\r
75 >>> split filenames on spaces. I suggest that =E2=80=9C2015 _ Richtlinien.p=\r
76 df:\r
77 >>> application/pdf=E2=80=9D should be quoted in notmuch-show-view-part.\r
78 >>>\r
79 >>> Note that saving attachment (=E2=80=9C.-s=E2=80=9D, notmuch-show-save-p=\r
80 art) generally\r
81 >>> works even if the attachment file names have spaces. In case it matters,\r
82 >>> I normally use the rc(1) shell in Debian <http://tobold.org/article/rc>.\r
83 >>\r
84 >> This code handles the saving and displaying in question (quick look hop i\r
85 >> am right :)\r
86 >>\r
87 >>    2282 (defun notmuch-show-save-part ()\r
88 >>    2283   "Save the MIME part containing point to a file."\r
89 >>    2284   (interactive)\r
90 >>    2285   (notmuch-show-apply-to-current-part-handle #'mm-save-part))\r
91 >>    2286=20\r
92 >>    2287 (defun notmuch-show-view-part ()\r
93 >>    2288   "View the MIME part containing point in an external viewer."\r
94 >>    2289   (interactive)\r
95 >>    2290   ;; Set mm-inlined-types to nil to force an external viewer\r
96 >>    2291   (let ((mm-inlined-types nil))\r
97 >>    2292     (notmuch-show-apply-to-current-part-handle #'mm-display-part=\r
98 )))\r
99 >>\r
100 >> SO, there is 2 options:\r
101 >>\r
102 >> 1) mm executes save part correctly but not display part\r
103 >\r
104 > It seems I cannot investigate this with my knowledge, as =E2=80=9CM-x\r
105 > find-function RET mm-display-part=E2=80=9D gives =E2=80=9CCan't find libr=\r
106 ary\r
107 > /usr/share/emacs/23.4/lisp/gnus/mm-decode.el=E2=80=9D. Any ideas?\r
108 \r
109 you could download emacs-el package or something....\r
110 \r
111 >\r
112 >> 2) there is (shell) wrapper program executing zathura which cannot handle\r
113 >>    arguments with spaces (there is plenty of examples of this!)\r
114 >>\r
115 >>\r
116 >> You could try to check how th external processes are executed by executi=\r
117 ng:\r
118 >>\r
119 >> strace -f -e trace=3Dprocess emacs -f notmuch\r
120 >>\r
121 >> (emacs on X is preferable in this case ;)\r
122 >\r
123 > Thank you for that suggestion. It seems that there does happen both some\r
124 > (wrong) escaping and splitting at spaces. I can see the following trace:\r
125 >\r
126 > --- snib ---\r
127 > execve("/usr/bin/zathura", ["/usr/bin/zathura", "/tmp/emm.23178ut2/2015\\=\r
128 ", "_\\", "Richtlinien.pdf"] [/* 51 vars */]) =3D 0\r
129 > --- snab ---\r
130 >\r
131 > Somewhat unusually, it is preceeded by an invocation of the shell:\r
132 >\r
133 > --- sneb ---\r
134 > execve("/usr/bin/rc", ["/usr/bin/rc", "-c", "/usr/bin/zathura /tmp/emm.23=\r
135 178u"...], [/* 51 vars */] <unfinished ...>\r
136 > --- snob ---\r
137 >\r
138 > It seems to me that all of the following are true in this case:\r
139 >\r
140 > 1. Emacs executes the user's default shell to start zathura.\r
141 \r
142 That's stupid! it should run /bin/sh.\r
143 \r
144 I looked into emacs-23.1/lisp/gnus/mm-decode.el and while I could not\r
145 pinpoint the exact location where this shell command was invoked, I\r
146 found some similar code where emacs variable `shell-file-name` was used\r
147 (M-x describe-variable shell-file-name returns "/bin/zsh" for me).\r
148 \r
149 So, you could just test by (setq shell-file-name "/bin/sh") (or=20\r
150 just M-x set-variable shell-file-name /bin/sh in live emacs) and then\r
151 test whether those pdf:s open right.\r
152 \r
153 we cannot do much how (mm in) emacs escapes those variables (and why it\r
154 uses shell to execute that command line)...\r
155 \r
156 Tomi\r
157 \r
158 >\r
159 > 2. For this, Emacs escapes the filename.\r
160 >\r
161 > 3. Emacs applies the wrong escaping to the filename. Note that single\r
162 >    quotes are interoperable between shells, while backslashes are not.\r
163 >\r
164 > 4. The rc(1) shell splits on spaces, as it knows no backslash escaping.\r
165 >\r
166 > 5. The shell executes zathura with three arguments, all bogus filenames.\r
167 >\r
168 > I cannot pinpoint where all this is happening, but I would suggest to\r
169 > just execve() zathura with a single unescaped filename as its argument.\r
170 >\r
171 > Greetings,\r
172 > --=20\r
173 > Nils Dagsson Moskopp // erlehmann\r
174 > <http://dieweltistgarnichtso.net>\r
175 > _______________________________________________\r
176 > notmuch mailing list\r
177 > notmuch@notmuchmail.org\r
178 > http://notmuchmail.org/mailman/listinfo/notmuch\r