Gnus development mailing list
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: emacs-devel@gnu.org
Cc: Lars Ingebrigtsen <larsi@gnus.org>, ding@gnus.org
Subject: Re: master ef14acf: Make nnml handle invalid non-ASCII headers more consistently
Date: Fri, 16 Dec 2022 23:42:21 +0100	[thread overview]
Message-ID: <874jtvq8c2.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <20210122180802.F0A1E20A10@vcs0.savannah.gnu.org> (Lars Ingebrigtsen's message of "Fri, 22 Jan 2021 13:08:02 -0500 (EST)")

* Lars Ingebrigtsen:

> branch: master
> commit ef14acfb68bb5b0ce42221e9681b93562f8085eb
> Author: Lars Ingebrigtsen <larsi@gnus.org>
> Commit: Lars Ingebrigtsen <larsi@gnus.org>
>
>     Make nnml handle invalid non-ASCII headers more consistently
>     
>     * lisp/gnus/nnml.el (nnml--encode-headers): New function to
>     RFC2047-encode invalid Subject/From headers (bug#45925).  This
>     will make them be displayed more consistently in the Summary
>     buffer (but still "wrong" sometimes, since there's not that much
>     we can guess at at this stage, charset wise).
>     (nnml-parse-head): Use it.
> ---
>  lisp/gnus/nnml.el | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/lisp/gnus/nnml.el b/lisp/gnus/nnml.el
> index ebececa..3cdfc74 100644
> --- a/lisp/gnus/nnml.el
> +++ b/lisp/gnus/nnml.el
> @@ -769,8 +769,24 @@ article number.  This function is called narrowed to an article."
>        (let ((headers (nnheader-parse-head t)))
>  	(setf (mail-header-chars  headers) chars)
>  	(setf (mail-header-number headers) number)
> +	;; If there's non-ASCII raw characters in the data,
> +	;; RFC2047-encode them to avoid having arbitrary data in the
> +	;; .overview file.
> +	(nnml--encode-headers headers)
>  	headers))))

Unfortunately, this change in particular causes Gnus to stops storing
messages into nnmail after receiving a message with this header:

From: =?utf-8?b?572X5YuH5YiaKFlvbmdnYW5nIEx1bykgdmlhIEVsZnV0aWxzLWRldmVs?=
 <elfutils-devel@sourceware.org>

The logged error message is:

Mail source (maildir :path …) failed: (error Invalid data for rfc2047 encoding: 罗勇刚(Yonggang Luo) via Elfutils-devel <elfutils-devel@sourceware.org>)

On an older Emacs without this change, it seems that the original header
is written to the .overview file, which sidestep the problem that not
all strings are encodable by the rfc2047 functions.

Thanks,
Florian



       reply	other threads:[~2022-12-16 23:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210122180801.14756.84264@vcs0.savannah.gnu.org>
     [not found] ` <20210122180802.F0A1E20A10@vcs0.savannah.gnu.org>
2022-12-16 22:42   ` Florian Weimer [this message]
2022-12-17  7:45     ` Eli Zaretskii
2022-12-17 14:57       ` Florian Weimer
2022-12-17 15:52         ` Eli Zaretskii
2022-12-19 13:59           ` Florian Weimer
2022-12-19 17:07             ` Eli Zaretskii
2022-12-19 17:27               ` Florian Weimer
2022-12-19 17:44                 ` Eli Zaretskii
2022-12-19 17:48               ` Eric Abrahamsen
2022-12-19 17:58                 ` Eli Zaretskii
2022-12-19 18:05                   ` Eric Abrahamsen
2022-12-19 18:16                     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874jtvq8c2.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=ding@gnus.org \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).