Gnus development mailing list
 help / color / mirror / Atom feed
From: Max Froumentin <max@lapin-bleu.net>
Subject: gnus PGP signature bug and fix
Date: Fri, 03 Feb 2006 12:10:48 +0000	[thread overview]
Message-ID: <87hd7gk5h3.fsf@lapin-bleu.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 1660 bytes --]

[resending, as my original post never made it to the group]

Gnus (latest CVS) generates wrong MIME encoded messages
when an inline PGP signature is included along with an attachment.

When a multipart message is sent, gnus builds a buffer by adding each
part sequentially, top to bottom. But there's a bug with the code that
generates inline signed parts: the point is not moved back to the bottom of
the buffer, and so the following parts are inserted at the wrong place.

A fix is simple: after each part is generated, move the point back to
the end.  i.e, in mml.el, around line 590, where it iterates over each
part, inserting a separator between each part and at the end.

             (let ((cont cont) part)
                (while (setq part (pop cont))
                  ;; Skip `multipart' and attributes.
                  (when (and (consp part) (consp (cdr part)))
                    (insert "\n--" mml-boundary "\n")
                    (mml-generate-mime-1 part))))
              (insert "\n--" mml-boundary "--\n")))))

Just insert "(goto-char (point-max))" after the call to mml-generate-mime-1:

              (let ((cont cont) part)
                (while (setq part (pop cont))
                  ;; Skip `multipart' and attributes.
                  (when (and (consp part) (consp (cdr part)))
                    (insert "\n--" mml-boundary "\n")
                    (mml-generate-mime-1 part)
                    (goto-char (point-max)))))
              (insert "\n--" mml-boundary "--\n")))))

I've tried it on various messages containing various attachments and it
seems to do the trick. A diff against mml.el 7.40 is attached.

Max.


[-- Attachment #2: mml-7.40.diff --]
[-- Type: text/plain, Size: 124 bytes --]

592,593c592
< 		    (mml-generate-mime-1 part)
< 		    (goto-char (point-max)))))
---
> 		    (mml-generate-mime-1 part))))

                 reply	other threads:[~2006-02-03 12:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=87hd7gk5h3.fsf@lapin-bleu.net \
    --to=max@lapin-bleu.net \
    /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).