From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrew Cohen Newsgroups: gmane.emacs.bugs Subject: bug#62815: Gnus: MIME types of attachments contain regexp quotation Date: Sun, 23 Apr 2023 10:43:27 +0800 Message-ID: <87bkjf8gj4.fsf@ust.hk> References: <87o7ns0ztt.fsf@physik.rwth-aachen.de> <83pm874z49.fsf@gnu.org> <831qkc2tq2.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8330"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 62815@debbugs.gnu.org, Arash Esbati , Andreas Schwab , bronger@physik.rwth-aachen.de, larsi@gnus.org, Andrew G Cohen To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 23 04:44:18 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 1pqPi6-00021t-1o for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 23 Apr 2023 04:44:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqPhs-00084N-He; Sat, 22 Apr 2023 22:44:04 -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 1pqPhq-00083h-Vi for bug-gnu-emacs@gnu.org; Sat, 22 Apr 2023 22:44:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqPhq-0003HC-Bi for bug-gnu-emacs@gnu.org; Sat, 22 Apr 2023 22:44:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pqPhp-0003J2-OC for bug-gnu-emacs@gnu.org; Sat, 22 Apr 2023 22:44:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrew Cohen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Apr 2023 02:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62815 X-GNU-PR-Package: emacs Original-Received: via spool by 62815-submit@debbugs.gnu.org id=B62815.168221783312685 (code B ref 62815); Sun, 23 Apr 2023 02:44:01 +0000 Original-Received: (at 62815) by debbugs.gnu.org; 23 Apr 2023 02:43:53 +0000 Original-Received: from localhost ([127.0.0.1]:44371 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqPhg-0003IW-KJ for submit@debbugs.gnu.org; Sat, 22 Apr 2023 22:43:52 -0400 Original-Received: from andy.bu.edu ([128.197.41.152]:43738) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqPhb-0003IG-La for 62815@debbugs.gnu.org; Sat, 22 Apr 2023 22:43:50 -0400 Original-Received: from [193.176.211.56] (helo=clove) by andy.bu.edu with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pqPhS-0005bQ-KT; Sat, 22 Apr 2023 22:43:39 -0400 In-Reply-To: <831qkc2tq2.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 22 Apr 2023 11:42:45 +0300") X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam_report: Spam detection software, running on the system "andy.bu.edu", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: >>>>> "EZ" == Eli Zaretskii writes: EZ> Andrew, perhaps you could look into this some time soon? It EZ> sounds like a recent regression, so I'd like to fix this in EZ> Emacs 29. (I've added Arash Esbati who filed the original bug that this commit was intended to fix, and Andreas since I think he understands mime handling in gnus and can probably comment.) Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed 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:260491 Archived-At: >>>>> "EZ" == Eli Zaretskii writes: EZ> Andrew, perhaps you could look into this some time soon? It EZ> sounds like a recent regression, so I'd like to fix this in EZ> Emacs 29. (I've added Arash Esbati who filed the original bug that this commit was intended to fix, and Andreas since I think he understands mime handling in gnus and can probably comment.) I have taken a quick look and think I understand what is going on, but I'm not positive. The mailcap-mime-data can include a regexp for the subtype; it appears that the only circumstance in which it is used as a regexp is matching the possible viewer to be used for this subtype. The patch in commit 3faa508eba84a1983732099cbd3cc1eaad404158 also treats mailcap-mime-extensions as regexps, which I think is a mistake: these should be associations between mime types and file extensions. If all this is right, the simple fix is to revert the part of 3faa508eba84a1983732099cbd3cc1eaad404158 that treated the extension data as regexps. I have attached a diff below that does this. If Torsten and Arash can check if this continues to provide a fix for bug#52038 and bug#62815 that would be great! There is one more place I think needs fixing (and maybe others I haven't spotted yet): the function mailcap-mime-types returns a list of mime types, and excludes any type that contains a wildcard: (unless (string-search "*" type) (push type res)) which suggests that this should be a list of actual types and not include regexps. Hence we should remove any regexp quoting from the entries. I have included a line that removes the "\\" in the diff. diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el index 10c5a7744c1..b8990266069 100644 --- a/lisp/net/mailcap.el +++ b/lisp/net/mailcap.el @@ -979,7 +979,7 @@ mailcap-mime-extensions (".vox" . "audio/basic") (".vrml" . "x-world/x-vrml") (".wav" . "audio/x-wav") - (".xls" . "application/vnd\\.ms-excel") + (".xls" . "application/vnd.ms-excel") (".wrl" . "x-world/x-vrml") (".xbm" . "image/xbm") (".xpm" . "image/xpm") @@ -1051,8 +1051,7 @@ mailcap-parse-mimetype-file (setq save-pos (point)) (skip-chars-forward "^ \t\n") (downcase-region save-pos (point)) - (setq type (mailcap--regexp-quote-type - (buffer-substring save-pos (point)))) + (setq type (buffer-substring save-pos (point))) (while (not (eolp)) (skip-chars-forward " \t") (setq save-pos (point)) @@ -1107,7 +1106,7 @@ mailcap-mime-types (dolist (info (cdr data)) (setq type (cdr (assq 'type (cdr info)))) (unless (string-search "*" type) - (push type res)))) + (push (string-replace "\\" "" type) res)))) (nreverse res))))) ;;; -- Andrew Cohen