Subject: bug#34387: 26.1; Gnus: handle empty message parts

From: Katsumi Yamaoka <[email-masked]>
Date: Tue, 12 Feb 2019 13:34:09 +0900

On Fri, 08 Feb 2019 15:58:19 +0100, Christophe Troestler wrote:
> Some messages only contain an attachment (no body) and
> (gnus-article-prepare-display) choke on the empty part.
> More specifically, `gnus-mime-display-single' does
> (narrow-to-region beg (point)) which fails if the part is empty.

Could you let me know how it fails?  Otherwise, could you show
me a sample email in question?  Unfortunately I'm not successful
in making such an email that causes the problem so far, and trying
(narrow-to-region beg beg) and (narrow-to-region (point) (point))
cause nothing special.

But I found at least two other kinds of problems in relation to
an empty attachment:

1. In the article buffer, pressing the RET key on an empty
 text/plain attachment conceals the succeeding other attachments,
 does not toggle.  `g' restores them of course, though.

2. Some kind of an empty mail isn't able to be edited using the
 `e' command (gnus-summary-edit-article), that is, a single part
 email whose body is an empty attachment.  Gnus misunderstands
 that the header is its body.

On Fri, 08 Feb 2019 16:39:47 +0100, Christophe Troestler wrote:
> For those who encounter this problem, a fix that does not require to
> modify the body of the function gnus-mime-display-single is:

> (define-advice gnus-mime-display-single (:around (oldfn &rest handle) fix)
>   "Protect against bad handling of empty message parts."
>   (ignore-errors (apply oldfn handle)))

I'd like to fix those problems in the Gnus code. :)

Thanks.
Regards,