From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Davide Masserut via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#65872: [PATCH] Fix interactive display of MIME parts Date: Mon, 11 Sep 2023 19:24:14 +0200 Message-ID: <87a5tsoc75.fsf@mssdvd.com> Reply-To: Davide Masserut Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28057"; mail-complaints-to="usenet@ciao.gmane.io" To: 65872@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 11 19:25:16 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qfkex-00072C-Iv for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Sep 2023 19:25:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfkel-0007CS-ES; Mon, 11 Sep 2023 13:25:03 -0400 Original-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 1qfkeg-00079t-83 for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 13:24:58 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfkef-0002b5-W7 for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 13:24:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qfkej-0002cg-NM for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 13:25:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Davide Masserut Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Sep 2023 17:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 65872 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.169445307510045 (code B ref -1); Mon, 11 Sep 2023 17:25:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Sep 2023 17:24:35 +0000 Original-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 Original-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 Original-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 Original-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== 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:270065 Archived-At: --=-=-= 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 --=-=-=--