--- /dev/null
+Return-Path: <nils@dieweltistgarnichtso.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id AB422431E62\r
+ for <notmuch@notmuchmail.org>; Tue, 10 Feb 2015 09:16:01 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 1.738\r
+X-Spam-Level: *\r
+X-Spam-Status: No, score=1.738 tagged_above=-999 required=5\r
+ tests=[DNS_FROM_AHBL_RHSBL=2.438, RCVD_IN_DNSWL_LOW=-0.7]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id WdbJwl8Nwlv1 for <notmuch@notmuchmail.org>;\r
+ Tue, 10 Feb 2015 09:15:58 -0800 (PST)\r
+Received: from mail.tiggerswelt.net (mail.tiggerswelt.net [94.186.151.130])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 376F0431FC7\r
+ for <notmuch@notmuchmail.org>; Tue, 10 Feb 2015 09:15:58 -0800 (PST)\r
+Received: from localhost (f055173025.adsl.alicedsl.de [78.55.173.25])\r
+ (using TLSv1 with cipher AES128-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by mail.tiggerswelt.net (Postfix) with ESMTP id 3F3615750;\r
+ Tue, 10 Feb 2015 18:17:00 +0100 (CET)\r
+From: Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net>\r
+To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org\r
+Subject: Re: bug report: Emacs notmuch-mode fails attachments with spaces\r
+In-Reply-To: <m24mqu455x.fsf@guru.guru-group.fi>\r
+References: <87twyurc78.fsf@dieweltistgarnichtso.net>\r
+ <m24mqu455x.fsf@guru.guru-group.fi>\r
+User-Agent: Notmuch/0.18.2 (http://notmuchmail.org) Emacs/23.4.1\r
+ (i486-pc-linux-gnu)\r
+Date: Tue, 10 Feb 2015 18:15:38 +0100\r
+Message-ID: <8761b9pu11.fsf@dieweltistgarnichtso.net>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="=-=-=";\r
+ micalg=pgp-sha256; protocol="application/pgp-signature"\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 10 Feb 2015 17:16:01 -0000\r
+\r
+--=-=-=\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+Tomi Ollila <tomi.ollila@iki.fi> writes:\r
+\r
+> On Mon, Feb 09 2015, Nils Dagsson Moskopp <nils@dieweltistgarnichtso.net>=\r
+ wrote:\r
+>\r
+>> Dear notmuch developers,\r
+>>\r
+>>\r
+>> I use notmuch-mode for GNU Emacs for managing my email.\r
+>>\r
+>> I think I have found a bug in notmuch-mode: If I do =E2=80=9C.-v=E2=80=\r
+=9D on the line =E2=80=9C[\r
+>> 2015 _ Richtlinien.pdf: application/pdf ]=E2=80=9D, then notmuch will op=\r
+en three\r
+>> windows of zathura (the PDF viewer I use).\r
+>>\r
+>> It seems to me that someone here either forgot quoting or decided to\r
+>> split filenames on spaces. I suggest that =E2=80=9C2015 _ Richtlinien.pd=\r
+f:\r
+>> application/pdf=E2=80=9D should be quoted in notmuch-show-view-part.\r
+>>\r
+>> Note that saving attachment (=E2=80=9C.-s=E2=80=9D, notmuch-show-save-pa=\r
+rt) generally\r
+>> works even if the attachment file names have spaces. In case it matters,\r
+>> I normally use the rc(1) shell in Debian <http://tobold.org/article/rc>.\r
+>\r
+> This code handles the saving and displaying in question (quick look hop i\r
+> am right :)\r
+>\r
+> 2282 (defun notmuch-show-save-part ()\r
+> 2283 "Save the MIME part containing point to a file."\r
+> 2284 (interactive)\r
+> 2285 (notmuch-show-apply-to-current-part-handle #'mm-save-part))\r
+> 2286=20\r
+> 2287 (defun notmuch-show-view-part ()\r
+> 2288 "View the MIME part containing point in an external viewer."\r
+> 2289 (interactive)\r
+> 2290 ;; Set mm-inlined-types to nil to force an external viewer\r
+> 2291 (let ((mm-inlined-types nil))\r
+> 2292 (notmuch-show-apply-to-current-part-handle #'mm-display-part)=\r
+))\r
+>\r
+> SO, there is 2 options:\r
+>\r
+> 1) mm executes save part correctly but not display part\r
+\r
+It seems I cannot investigate this with my knowledge, as =E2=80=9CM-x\r
+find-function RET mm-display-part=E2=80=9D gives =E2=80=9CCan't find library\r
+/usr/share/emacs/23.4/lisp/gnus/mm-decode.el=E2=80=9D. Any ideas?\r
+\r
+> 2) there is (shell) wrapper program executing zathura which cannot handle\r
+> arguments with spaces (there is plenty of examples of this!)\r
+>\r
+>\r
+> You could try to check how th external processes are executed by executin=\r
+g:\r
+>\r
+> strace -f -e trace=3Dprocess emacs -f notmuch\r
+>\r
+> (emacs on X is preferable in this case ;)\r
+\r
+Thank you for that suggestion. It seems that there does happen both some\r
+(wrong) escaping and splitting at spaces. I can see the following trace:\r
+\r
+=2D-- snib ---\r
+execve("/usr/bin/zathura", ["/usr/bin/zathura", "/tmp/emm.23178ut2/2015\\",=\r
+ "_\\", "Richtlinien.pdf"] [/* 51 vars */]) =3D 0\r
+=2D-- snab ---\r
+\r
+Somewhat unusually, it is preceeded by an invocation of the shell:\r
+\r
+=2D-- sneb ---\r
+execve("/usr/bin/rc", ["/usr/bin/rc", "-c", "/usr/bin/zathura /tmp/emm.2317=\r
+8u"...], [/* 51 vars */] <unfinished ...>\r
+=2D-- snob ---\r
+\r
+It seems to me that all of the following are true in this case:\r
+\r
+1. Emacs executes the user's default shell to start zathura.\r
+\r
+2. For this, Emacs escapes the filename.\r
+\r
+3. Emacs applies the wrong escaping to the filename. Note that single\r
+ quotes are interoperable between shells, while backslashes are not.\r
+\r
+4. The rc(1) shell splits on spaces, as it knows no backslash escaping.\r
+\r
+5. The shell executes zathura with three arguments, all bogus filenames.\r
+\r
+I cannot pinpoint where all this is happening, but I would suggest to\r
+just execve() zathura with a single unescaped filename as its argument.\r
+\r
+Greetings,\r
+=2D-=20\r
+Nils Dagsson Moskopp // erlehmann\r
+<http://dieweltistgarnichtso.net>\r
+\r
+--=-=-=\r
+Content-Type: application/pgp-signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1\r
+\r
+iF4EAREIAAYFAlTaPLsACgkQZGjbY/Ag5QmGRQEApr9FG6WpfkDUjLxhdGu4DbtG\r
+dIoF/fSqfU4pSUlY7U0A/AoyfkDs8DrdvXekmBfBCGbIf04xv7a7o1CqFCU5EQtq\r
+=hh19\r
+-----END PGP SIGNATURE-----\r
+--=-=-=--\r