Package: emacs
Version: 1:28.2+1-13
Severity: important

A regression in Emacs 28 prevents Gnus from importing any further mail
into its nnml sotre once a message with certain (valid) header is
encountered in incoming mail.  The gnu.org systems seem to be having
problems right now, but it's discussed in this subthread:

From: Florian Weimer <fwei...@redhat.com>
Subject: Re: master ef14acf: Make nnml handle invalid non-ASCII headers more
 consistently
To: emacs-de...@gnu.org
Cc: Lars Ingebrigtsen <la...@gnus.org>, d...@gnus.org
Date: Fri, 16 Dec 2022 23:42:21 +0100 (13 weeks, 6 days, 11 hours ago)
Message-ID: <874jtvq8c2....@oldenburg.str.redhat.com>
  
Please backport the commit below; it fixes the issue and is supposed
not to break the .overview file encoded.

This does not impact all Emacs users (or even all Gnus users), so I'm
not setting severity to serious, but it's an upgrade blocker for nnml
users.

commit 23f7c9c2a92e4619b7c4d2286d4249f812cd695d
Author: Eli Zaretskii <e...@gnu.org>
Date:   Mon Dec 19 19:01:04 2022 +0200

    Fix storing email into nnmail by Gnus
    
    * lisp/gnus/nnml.el (nnml--encode-headers): Wrap
    'rfc2047-encode-string' calls with 'ignore-errors', to avoid
    disrupting email workflows due to possibly-invalid headers.
    Reported by Florian Weimer <fwei...@redhat.com>.

diff --git a/lisp/gnus/nnml.el b/lisp/gnus/nnml.el
index 40e4b9ea828..7aa445e6646 100644
--- a/lisp/gnus/nnml.el
+++ b/lisp/gnus/nnml.el
@@ -776,17 +776,22 @@ article number.  This function is called narrowed to an 
article."
        (nnml--encode-headers headers)
        headers))))
 
+;; RFC2047-encode Subject and From, but leave invalid headers unencoded.
 (defun nnml--encode-headers (headers)
   (let ((subject (mail-header-subject headers))
        (rfc2047-encoding-type 'mime))
     (unless (string-match "\\`[[:ascii:]]*\\'" subject)
-      (setf (mail-header-subject headers)
-           (mail-encode-encoded-word-string subject t))))
+      (let ((encoded-subject
+             (ignore-errors (mail-encode-encoded-word-string subject t))))
+        (if encoded-subject
+            (setf (mail-header-subject headers) encoded-subject)))))
   (let ((from (mail-header-from headers))
        (rfc2047-encoding-type 'address-mime))
     (unless (string-match "\\`[[:ascii:]]*\\'" from)
-      (setf (mail-header-from headers)
-           (rfc2047-encode-string from t)))))
+      (let ((encoded-from
+             (ignore-errors (rfc2047-encode-string from t))))
+        (if encoded-from
+            (setf (mail-header-from headers) encoded-from))))))
 
 (defun nnml-get-nov-buffer (group &optional incrementalp)
   (let ((buffer (gnus-get-buffer-create

Reply via email to