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

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

> Cc: [email-masked]
> From: Robert Pluim <[email-masked]>
> Date: Tue, 26 Aug 2025 15:39:00 +0200
> 
> >>>>> On Mon, 25 Aug 2025 11:51:46 +0200, Francesco Potortì <[email-masked]> said:
> 
>     Francesco> Rmail says: "MIME decoding failed: (error Message is not a valid RFC 822 (or later) message)" when reading the attached mbox.  Apart from the error message, everything looks ok at first alright.  Sorry, no time to look at it at this the moment.
>     Francesco> To reproduce:
>     Francesco> - save the attachment
>     Francesco> - emacs -Q
>     Francesco> - C-u M-x rmail RET
>     Francesco> - the name of the saved attachment RET
> 
>     Francesco> For me, Rmail apparently does the right thing, but prints the above error message.
> 
> The issue is that the message in question is a digest, and rmail tries
> to copy out the headers from the component parts using
> `rmail-copy-headers', but the first part looks like this:
> 
> ---begin--
> --cc57bd385044d4e75b21e375607f07ba
> 
> Content-Type: text/plain
> 
> debian-changes-digest Digest				Volume 2025 : Issue 139
> 
> --end--
> 
> 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'.

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

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

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

which the mbox file in question doesn't have.

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

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