unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Glenn Morris <rgm@gnu.org>
To: Ken Olum <kdo@cosmos.phy.tufts.edu>
Cc: 26918@debbugs.gnu.org
Subject: bug#26918: 25.2; rmail edit corrupts mail if content-type header not displayed
Date: Mon, 05 Jun 2017 17:16:56 -0400	[thread overview]
Message-ID: <o0y3t69ltj.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <q521srs1akz.fsf@cosmos.phy.tufts.edu> (Ken Olum's message of "Sat, 13 May 2017 21:38:52 -0400")

Ken Olum wrote:

> If you have a message in rmail which is in MIME format with base64
> encoding and consists only of a single text/plain part, and if you do
> not display the "Content-Type" header (e.g. by having it in
> rmail-ignored-headers), the message will get corrupted.  The problem is
> this: under the circumstances above, rmail-edit-current-message allows
> you to edit your view of the message (which is good, since you don't
> want to edit the base64).  But when it goes to reencode the message, it
> looks in the headers it gave you to edit and doesn't see the
> Content-Type.  Later it does see the Content-Type in the original
> headers, and the result is massive confusion.  In some circumstances it
> corrupts only that message, but in others it corrupts your mail file by
> merging this message with the one before.
>
> To reproduce:
>
> 1. emacs -Q
>
> 2. Visit attached rmail-test file
>
> 3. M-x rmail-mode
>
> 4. Set variable rmail-ignored-headers to ignore "Content-Type", e.g., by
> editing it in customization system.
>
> 5. Push "t" twice so that previous change takes effect.  Verify that
> Content-Type is not displayed.
>
> 6. Push "e" to edit message.  Insert a character at the end.  C-c C-c to
> finish.
>
> 7. Observe corrupted message on screen
>
> I'm not sure how to reproduce the situation where it corrupts your mail
> file, but it has happened to me several times.
>
> I can provide a fix for this bug if we agree on the right strategy.

It seems neither rmail user has an opinion. ;)
What do you suggest?
Two ideas that come to mind are:
1) force the relevant header(s) to be visible when editing a message
2) if the headers are not found in the message as edited, consult the
full unswapped message. (I wonder what happens if an edit adds a new,
duplicate Content-Type header that disagrees with the pre-existing one...)





  reply	other threads:[~2017-06-05 21:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-14  1:38 bug#26918: 25.2; rmail edit corrupts mail if content-type header not displayed Ken Olum
2017-06-05 21:16 ` Glenn Morris [this message]
2017-06-06 15:06   ` Ken Olum
2017-06-08 18:10     ` Glenn Morris
2017-06-19 18:40 ` bug#26918: rmail-cease-edit patches for bugs 26918 and 27353 Ken Olum
2017-09-08  9:11   ` bug#27353: " Eli Zaretskii

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=o0y3t69ltj.fsf@fencepost.gnu.org \
    --to=rgm@gnu.org \
    --cc=26918@debbugs.gnu.org \
    --cc=kdo@cosmos.phy.tufts.edu \
    /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).