GNU bug report logs - #28671
25.2; double transfer-encoding in rmailedit for complex mime messages

Previous Next

Package: emacs;

Reported by: Ken Olum <kdo <at> cosmos.phy.tufts.edu>

Date: Mon, 2 Oct 2017 15:39:02 UTC

Severity: normal

Found in version 25.2

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28671 in the body.
You can then email your comments to 28671 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#28671; Package emacs. (Mon, 02 Oct 2017 15:39:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ken Olum <kdo <at> cosmos.phy.tufts.edu>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 02 Oct 2017 15:39:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ken Olum <kdo <at> cosmos.phy.tufts.edu>
To: bug-gnu-emacs <at> gnu.org
Cc: kdo <at> cosmos.phy.tufts.edu
Subject: 25.2; double transfer-encoding in rmailedit for complex mime messages
Date: Mon, 02 Oct 2017 11:37:46 -0400
[Message part 1 (text/plain, inline)]
When rmail-edit-current-message gets a mime message which is too complex
for it to handle (i.e., anything but one "text/plain" part), it just
gives you the raw message to edit.  If you do so, rmail-cease-edit then
applies the transfer-encoding even though the message wasn't decoded,
and so on.  It also in some circumstances it also moves the marker for
the beginning of the following message.

The attached patch modifies rmail-cease-edit to check the
rmail-old-mime-state flag set by rmail-edit-current-message when it is
editing the raw message.  If set, rmail-cease-edit inserts the
already-encoded body without further processing.  It also deletes the
old body after inserting the new, rather than before, to avoid moving
the next message's marker.

                                        Ken

In GNU Emacs 25.2.2 (x86_64-unknown-linux-gnu, X toolkit, Xaw scroll bars)
 of 2017-05-29 built on olum.org
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description:	Ubuntu 16.04.3 LTS

Configured features:
XPM JPEG TIFF GIF PNG SOUND NOTIFY FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS
LUCID X11

[rmailedit.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28671; Package emacs. (Mon, 02 Oct 2017 16:39:02 GMT) Full text and rfc822 format available.

Message #8 received at 28671 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ken Olum <kdo <at> cosmos.phy.tufts.edu>
Cc: kdo <at> cosmos.phy.tufts.edu, 28671 <at> debbugs.gnu.org
Subject: Re: bug#28671: 25.2;
 double transfer-encoding in rmailedit for complex mime messages
Date: Mon, 02 Oct 2017 19:37:55 +0300
> From: Ken Olum <kdo <at> cosmos.phy.tufts.edu>
> Date: Mon, 02 Oct 2017 11:37:46 -0400
> Cc: kdo <at> cosmos.phy.tufts.edu
> 
> When rmail-edit-current-message gets a mime message which is too complex
> for it to handle (i.e., anything but one "text/plain" part), it just
> gives you the raw message to edit.  If you do so, rmail-cease-edit then
> applies the transfer-encoding even though the message wasn't decoded,
> and so on.  It also in some circumstances it also moves the marker for
> the beginning of the following message.
> 
> The attached patch modifies rmail-cease-edit to check the
> rmail-old-mime-state flag set by rmail-edit-current-message when it is
> editing the raw message.  If set, rmail-cease-edit inserts the
> already-encoded body without further processing.  It also deletes the
> old body after inserting the new, rather than before, to avoid moving
> the next message's marker.

Thanks.  Could you please send a small mbox file which could be used
to reproduce the problem and test the solution?

A couple of minor comments to the patch:

>  	;; Re-apply content-transfer-encoding, if any, on the message body.
> -	(cond
> -	 ((string= character-coding "quoted-printable")
> -	  (mail-quote-printable-region start (point-max)))
> -	 ((and (string= character-coding "base64") is-text-message)
> -	  (base64-encode-region start (point-max)))
> -	 ((and (eq character-coding 'uuencode) is-text-message)
> -	  (error "uuencoded messages are not supported")))
> +        (unless mime-state              ; if set, already transfer-encoded
> +          (cond
> +           ((string= character-coding "quoted-printable")
> +            (mail-quote-printable-region start end))
> +           ((and (string= character-coding "base64") is-text-message)
> +            (base64-encode-region start end))
> +           ((and (eq character-coding 'uuencode) is-text-message)
> +            (error "uuencoded messages are not supported"))))

You could easily make the change less intrusive by simply adding the
mime-state condition as the first alternative in 'cond' with no
action, right?

Also, please add a commit log message for the changes formatted as a
ChangeLog entry (e.g., using "C-x 4 a").




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28671; Package emacs. (Mon, 02 Oct 2017 17:48:01 GMT) Full text and rfc822 format available.

Message #11 received at 28671 <at> debbugs.gnu.org (full text, mbox):

From: Ken Olum <kdo <at> cosmos.phy.tufts.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: kdo <at> cosmos.phy.tufts.edu, 28671 <at> debbugs.gnu.org
Subject: Re: bug#28671: 25.2;
 double transfer-encoding in rmailedit for complex mime messages
Date: Mon, 02 Oct 2017 13:47:20 -0400
[Message part 1 (text/plain, inline)]
Here is a test file.  Edit the first message and make some change (e.g.,
to the subject header).  Then the body will end up base64 encoded
twice.  If you then go to the next message, the headers will have extra
lines at the top due to marker problems.  The patch should fix these
problems.

Here's a new patch with the simplified code as you suggested, and
here's a change log entry:

----------------------------------------------------------------------
2017-10-02  Ken Olum  <kdo <at> cosmos.phy.tufts.edu>

	Fix problems when editing raw message (Bug#28671)

	* lisp/mail/rmailedit.el (rmail-cease-edit): if rmail-old-mime-state
	is set, meaning that we are editing the raw message, do not
	encode it again.  Delete old body after, not before, inserting
	new, to avoid moving marker at beginning of next message.
----------------------------------------------------------------------

                                        Ken

[rmail-test (application/octet-stream, attachment)]
[rmailedit.patch (text/x-diff, attachment)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Mon, 09 Oct 2017 13:57:02 GMT) Full text and rfc822 format available.

Notification sent to Ken Olum <kdo <at> cosmos.phy.tufts.edu>:
bug acknowledged by developer. (Mon, 09 Oct 2017 13:57:03 GMT) Full text and rfc822 format available.

Message #16 received at 28671-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ken Olum <kdo <at> cosmos.phy.tufts.edu>
Cc: 28671-done <at> debbugs.gnu.org
Subject: Re: bug#28671: 25.2;
 double transfer-encoding in rmailedit for complex mime messages
Date: Mon, 09 Oct 2017 16:55:55 +0300
> From: Ken Olum <kdo <at> cosmos.phy.tufts.edu>
> Cc: 28671 <at> debbugs.gnu.org, kdo <at> cosmos.phy.tufts.edu
> Date: Mon, 02 Oct 2017 13:47:20 -0400
> 
> Here is a test file.  Edit the first message and make some change (e.g.,
> to the subject header).  Then the body will end up base64 encoded
> twice.  If you then go to the next message, the headers will have extra
> lines at the top due to marker problems.  The patch should fix these
> problems.
> 
> Here's a new patch with the simplified code as you suggested, and
> here's a change log entry:

Thanks, pushed to the release branch.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 07 Nov 2017 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 285 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.