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
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
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
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
55 On Tue, Feb 10 2015, Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net> w=
\r
58 > Tomi Ollila <tomi.ollila@iki.fi> writes:
\r
60 >> On Mon, Feb 09 2015, Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net=
\r
63 >>> Dear notmuch developers,
\r
66 >>> I use notmuch-mode for GNU Emacs for managing my email.
\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
72 >>> windows of zathura (the PDF viewer I use).
\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
77 >>> application/pdf=E2=80=9D should be quoted in notmuch-show-view-part.
\r
79 >>> Note that saving attachment (=E2=80=9C.-s=E2=80=9D, notmuch-show-save-p=
\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
84 >> This code handles the saving and displaying in question (quick look hop i
\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
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
100 >> SO, there is 2 options:
\r
102 >> 1) mm executes save part correctly but not display part
\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
107 > /usr/share/emacs/23.4/lisp/gnus/mm-decode.el=E2=80=9D. Any ideas?
\r
109 you could download emacs-el package or something....
\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
116 >> You could try to check how th external processes are executed by executi=
\r
119 >> strace -f -e trace=3Dprocess emacs -f notmuch
\r
121 >> (emacs on X is preferable in this case ;)
\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
127 > execve("/usr/bin/zathura", ["/usr/bin/zathura", "/tmp/emm.23178ut2/2015\\=
\r
128 ", "_\\", "Richtlinien.pdf"] [/* 51 vars */]) =3D 0
\r
131 > Somewhat unusually, it is preceeded by an invocation of the shell:
\r
134 > execve("/usr/bin/rc", ["/usr/bin/rc", "-c", "/usr/bin/zathura /tmp/emm.23=
\r
135 178u"...], [/* 51 vars */] <unfinished ...>
\r
138 > It seems to me that all of the following are true in this case:
\r
140 > 1. Emacs executes the user's default shell to start zathura.
\r
142 That's stupid! it should run /bin/sh.
\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
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
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
159 > 2. For this, Emacs escapes the filename.
\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
164 > 4. The rc(1) shell splits on spaces, as it knows no backslash escaping.
\r
166 > 5. The shell executes zathura with three arguments, all bogus filenames.
\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
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