unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: Rainer Gemulla <rgemulla@gmx.de>
Cc: 39884@debbugs.gnu.org
Subject: bug#39884: 27.0.50; Emacs may destroy outgoing email messages during sending
Date: Wed, 15 Apr 2020 08:24:52 -0400	[thread overview]
Message-ID: <CAM-tV--T5pOkUiRstWFsP+Wi0SObFkyKpT+-oPBXTF=REQ8g-g@mail.gmail.com> (raw)
In-Reply-To: <87pnc95gq5.fsf@macho>

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

On Wed, 15 Apr 2020 at 03:55, Rainer Gemulla <rgemulla@gmx.de> wrote:
>
> Replacing in function mml-parse-1 (mml.el, line 284):
>
> (setq tag (list 'part '(type . "text/plain"))
>        no-markup-p t
>        warn t)
>
> with
>
> (setq tag `(part (type . ,"text/plain"))
>       no-markup-p t
>       warn t)
>
> seems to fix this bug. It's not clear to me why though.

mml-parse-1 calls nconc on tag, so it's likely some destructive
modification of code literals is happening. However, I'm not able to
reproduce the bug following your instructions on the latest emacs-27
checkout. I'm attaching a lisp file which automates the process (I
also tried doing it manually, in case that makes a difference).

[-- Attachment #2: bug-39884-bad-mml-parsing.el --]
[-- Type: text/x-emacs-lisp, Size: 2613 bytes --]

(defconst bug-39884-orig-message "\
From: a <at> b.ce
To: c <at> d.de
Subject: Test
--text follows this line--
Test

<#mml type=message/rfc822 disposition=inline>
<#multipart type=alternative>
<#part type=text/plain charset=\"UTF-8\" disposition=inline nofile=yes>
Some text.
<#part type=text/html charset=\"UTF-8\" nofile=yes>
Some more text.
<#/multipart>
<#/mml>
")

(defconst bug-39884-correct-result "\
From: a <at> b.ce
To: c <at> d.de
Subject: Test
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=\"=-=-=\"
--text follows this line--
--=-=-=
Content-Type: text/plain

Test


--=-=-=
Content-Type: message/rfc822
Content-Disposition: inline

--====-=-=
Content-Disposition: inline
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary=\"====-=-=\"

Some text.

--====-=-=
Content-Type: text/html; charset=utf-8

Some more text.

--====-=-=--

--=-=-=--
")

(defconst 39884-correct-results-of-step-9
  "\
From: a <at> b.ce
To: c <at> d.de
Subject: Test
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=\"=-=-=\"
--text follows this line--
--=-=-=
Content-Type: multipart/alternative; boundary=\"====-=-=\"
Content-Transfer-Encoding: base64

VGV4dAoK
--=-=-=
Content-Type: message/rfc822
Content-Disposition: inline

--====-=-=
Content-Disposition: inline
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary=\"====-=-=\"

Some text.

--====-=-=
Content-Type: text/html; charset=utf-8

Some more text.

--====-=-=--

--=-=-=--
")

;; 2. M-x message-mode
(message-mode)
;; 3. Clear scratch buffer, paste original message
(erase-buffer)
(insert bug-39884-orig-message)

;; 4. M-: (mml-to-mime) --> gives CORRECT result
(goto-char (point-min))
(mml-to-mime)
(cl-assert (equal (buffer-string) bug-39884-correct-result))

;; 5. Clear scratch buffer, paste original message
(erase-buffer)
(insert bug-39884-orig-message)

;; 6. Insert a new line "<#secure method=pgpmime mode=sign>" at start of 
;; message (after line "--text follows this line--"). This makes Emacs try 
;; to sign the mail.
(search-backward "--text follows this line--")
(forward-line)
(insert "<#secure method=pgpmime mode=sign>\n")

;; 7. M-: (mml-to-mime) --> throws (expected) signer name error
(cl-assert (condition-case ()
               (progn (goto-char (point-min))
                      (mml-to-mime)
                      nil)
             (error t)))

;; 8. Clear scratch buffer, paste original message
(erase-buffer)
(insert bug-39884-orig-message)

;; 9. M-: (mml-to-mime)
;;   --> broken result (first Content-Type after "text follows..." is 
;; wrong)
(goto-char (point-min))
(mml-to-mime)

  reply	other threads:[~2020-04-15 12:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-03 15:36 bug#39884: 27.0.50; Emacs may destroy outgoing email messages during sending Rainer Gemulla
2020-04-15  7:51 ` bug#39884: Simple fix Rainer Gemulla
2020-04-15 12:24   ` Noam Postavsky [this message]
2020-04-15 12:57     ` bug#39884: 27.0.50; Emacs may destroy outgoing email messages during sending Rainer Gemulla
2020-04-15 13:11       ` Noam Postavsky
2020-04-17  0:30 ` Noam Postavsky
2020-04-17  7:48   ` Rainer Gemulla
2020-04-17  7:49   ` Rainer Gemulla
2020-04-17  9:54   ` Eli Zaretskii
2020-04-25 13:59     ` Noam Postavsky

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='CAM-tV--T5pOkUiRstWFsP+Wi0SObFkyKpT+-oPBXTF=REQ8g-g@mail.gmail.com' \
    --to=npostavs@gmail.com \
    --cc=39884@debbugs.gnu.org \
    --cc=rgemulla@gmx.de \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).