From unknown Fri Jun 20 07:18:09 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#65872 <65872@debbugs.gnu.org> To: bug#65872 <65872@debbugs.gnu.org> Subject: Status: [PATCH] Fix interactive display of MIME parts Reply-To: bug#65872 <65872@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:18:09 +0000 retitle 65872 [PATCH] Fix interactive display of MIME parts reassign 65872 emacs submitter 65872 Davide Masserut severity 65872 normal tag 65872 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 11 13:24:35 2023 Received: (at submit) by debbugs.gnu.org; 11 Sep 2023 17:24:35 +0000 Received: from localhost ([127.0.0.1]:54683 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfkeJ-0002bx-36 for submit@debbugs.gnu.org; Mon, 11 Sep 2023 13:24:35 -0400 Received: from lists.gnu.org ([2001:470:142::17]:51442) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfkeG-0002bi-Lb for submit@debbugs.gnu.org; Mon, 11 Sep 2023 13:24:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qfke7-0006iH-6r for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 13:24:23 -0400 Received: from out-214.mta0.migadu.com ([91.218.175.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qfke3-0002YS-QY for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 13:24:22 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mssdvd.com; s=key1; t=1694453056; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=wS2JjA3QHfre9D0YC4EGOREGMKH8tSriDu40g+IJegg=; b=Q+Rp4A0CsDEkcP6VvhSZ1IVc8/tx6RgzgJENZbFV5AO5SeYAG5O2chevZYuo1j09iAEkcF vGVQ9Ij6NxTqIZqp16BLuH/is4kqniP8mTZxM7LjKkEKo8BuPDvGX652HWUkEJ9WbnYCKl nGwcjp5CTxgXmOeEwRmtBNQBBeXbLbve+Enbrv7WkttWQ+i9Fxox9F1f7nZ6NHqykkBTGw rrXp9OYwTqcdNQy6WFYeLbZ0MA3SxhGVahpgrAIi/+70J8Ap97lYPDsghACPXiR+0Dh1X8 W0qrin48pBkqYrxhvIafz+67CxKFzJcdEWsGgUCGmB91GFsSWIh/1/v62HM1xw== From: Davide Masserut To: bug-gnu-emacs@gnu.org Subject: [PATCH] Fix interactive display of MIME parts Date: Mon, 11 Sep 2023 19:24:14 +0200 Message-ID: <87a5tsoc75.fsf@mssdvd.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=91.218.175.214; envelope-from=dm@mssdvd.com; helo=out-214.mta0.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain Tags: patch This patch fixes a bug that did not allow to view attachments after choosing to display them within Emacs. The issue is in mm-interactively-view-part, which is used by gnus-article-interactively-view-part and notmuch-show-interactively-view-part. mailcap-mime-info may return a list of functions or strings containing external commands. This list is passed to completing-read, which always returns a string. Before this change, when the method is a string, mm-display-external would have attempted to execute it through a shell even when the method refers to an Elisp function. I discovered this bug while using notmuch with notmuch-show-part-button-default-action set to #'notmuch-show-interactively-view-part and having tried to open a pdf with doc-view-mode. This bug should also be reproducible using Gnus but I don't know how to do it. In GNU Emacs 30.0.50 (build 24, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.17.8) of 2023-09-11 built on T480s Repository revision: b3ef1d67919261c3af3e12c14f3d66c4d156cc19 Repository branch: master System Description: Arch Linux Configured using: 'configure -C --prefix /home/davide/.local --with-pgtk --with-native-compilation --enable-link-time-optimization --enable-locallisppath=/usr/share/emacs/site-lisp/ 'CFLAGS=-march=native -O2'' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Fix-interactive-display-of-MIME-parts.patch >From 9f45d1b4c06bea2ffca7f7575f7600e8530b3814 Mon Sep 17 00:00:00 2001 From: Davide Masserut Date: Mon, 11 Sep 2023 16:49:21 +0200 Subject: [PATCH] Fix interactive display of MIME parts mailcap-mime-info may return a list of functions or strings containing external commands. This list is passed to completing-read, which always returns a string. Before this change, when the method is a string, mm-display-external would have attempted to execute it through a shell even when the method refers to an Elisp function. * lisp/gnus/mm-decode.el (mm-interactively-view-part): When method contains a valid symbol, extract it using intern. --- lisp/gnus/mm-decode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index b9beedf6c5c..1f91491afa1 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el @@ -1501,7 +1501,7 @@ mm-interactively-view-part (when (string= method "") (error "No method given")) (if (string-match "^[^% \t]+$" method) - (setq method (concat method " %s"))) + (setq method (or (intern-soft method) (concat method " %s")))) (mm-display-external handle method))) (defun mm-preferred-alternative (handles &optional preferred) -- 2.42.0 --=-=-=--