Subject: bug#79307: 30.1; Rmail: MIME decoding failed

From: Robert Pluim <[email-masked]>
Date: Sat, 30 Aug 2025 20:43:19 +0200

>>>>> On Sat, 30 Aug 2025 13:08:36 +0300, Eli Zaretskii <[email-masked]> said:

    >> Which doesnʼt match rmailʼs expectations of it starting with a "From"
    >> line before the headers, hence rmail.el:2917 calls
    >> `rmail-error-bad-format'.

    Eli> Isn't the actual problem that this digest doesn't say it's a digest?
    Eli> rmailmm.el:rmail-mime-process-multipart seems to know about that.  The
    Eli> digests sent by the emacs-diffs list, for example, have these two
    Eli> parts:

    Eli>   Content-Type: text/plain; charset="utf-8"
    Eli>   MIME-Version: 1.0
    Eli>   Content-Transfer-Encoding: base64
    Eli>   Content-Description: Emacs-diffs Digest, Vol 273, Issue 66

    Eli>   Content-Type: text/plain; charset="utf-8"
    Eli>   MIME-Version: 1.0
    Eli>   Content-Transfer-Encoding: base64
    Eli>   Content-Description: Today's Topics (8 messages)

    Eli> which the mbox file in question doesn't have.

The headers in the mbox look like this:

    MIME-Version: 1.0
    Content-Type: multipart/digest; boundary="cc57bd385044d4e75b21e375607f07ba"
    To: [email-masked]

so it is a digest.

    Eli> So maybe we should instead try to identify such digests as such?  Just
    Eli> getting past such lines sounds a bit dangerous to me.

FWIW, gnus displays the provided mbox correctly, but for the first
text/plain part it displays it as a message with a From and Subject of
"none". I donʼt know how rmail displays digests, but we could do
something similar there.

    Eli> Anyway, does anyone know whether the Debian digest indeed violate the
    Eli> RFC-822 standard?

The relevant rfc is rfc2046, which in section 5.1.5 says:

   Note: Though it is possible to specify a Content-Type value for a
   body part in a digest which is other than "message/rfc822", such as a
   "text/plain" part containing a description of the material in the
   digest, actually doing so is undesireble. The "multipart/digest"
   Content-Type is intended to be used to send collections of messages.
   If a "text/plain" part is needed, it should be included as a seperate
   part of a "multipart/mixed" message.

so having a text/plain part in the digest is allowed, just
discouraged. I donʼt have an emacs-diffs digest to hand, but I assume
it has a top-level Content-Type of multipart/mixed, and then a
subsequent multipart/digest part, with a bunch of constituent
message/rfc822 parts.

Robert
--