unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: Daniel Kahn Gillmor <dkg@fifthhorseman.net>,
	Notmuch Mail <notmuch@notmuchmail.org>
Subject: Re: BUG: emacs: fcc duplicates messages with variant bodies due to mml security
Date: Wed, 19 Jan 2022 09:56:51 -0400	[thread overview]
Message-ID: <87v8yfvnfg.fsf@tethera.net> (raw)
In-Reply-To: <87k1zm225v.fsf@fifthhorseman.net>

Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:

>
> I'm currently working around this by setting notmuch-fcc-dirs to nil,
> and setting message-send-mail-hook to (dkg-notmuch-fcc), which is defined
> as:
>
>     (defun dkg-notmuch-fcc ()
>       (shell-command-on-region (point-min) (point-max) "notmuch insert"))
>
> this takes advantage of message-send-mail-hook's late-send.  as the
> documentation for that var says:
>
>     This hook is run very late -- just before the message is sent as
>     mail.
>
> But this isn't something normal users should need to do manually.
>
> Any emacs gurus want to propose a way to improve the situation?  i'm at
> a bit of a loss.

Not an "emacs guru". However... 

Currently our fcc processing is run (in a slightly weird way by
rebinding message-do-fcc) just before message-sent-hook. This has the
potentially important semantics that it only runs for messages that are
successfully sent.

There is a variable message-encoded-mail-cache, which holds the raw sent
message. We should probably use this instead of doing our own
re-encoding (mml-generate-mime does the actual mime stuff, and is called
from message-encode-message-body. Larsi added this variable to gnus
after we copied and modified message-do-fcc. The change _looks_
relatively simple, guarding the call to message-encode-message-body as
follows:

	;; Avoid re-doing things like GPG-encoding secret parts.
	(if (not encoded-cache)
	    (message-encode-message-body)
	  (erase-buffer)
	  (insert encoded-cache))

  reply	other threads:[~2022-01-19 13:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-22 23:28 BUG: emacs: fcc duplicates messages with variant bodies due to mml security Daniel Kahn Gillmor
2022-01-19 13:56 ` David Bremner [this message]
2022-01-20  2:44   ` [PATCH] test/emacs: known broken test for matching fcc and sent message David Bremner
2022-01-20  3:02     ` David Bremner
2022-01-20 22:00       ` Tomi Ollila
2022-01-21  0:21         ` David Bremner
2022-01-21 11:37         ` David Bremner
2022-01-26 11:55 ` BUG: emacs: fcc duplicates messages with variant bodies due to mml security David Bremner

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://notmuchmail.org/

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

  git send-email \
    --in-reply-to=87v8yfvnfg.fsf@tethera.net \
    --to=david@tethera.net \
    --cc=dkg@fifthhorseman.net \
    --cc=notmuch@notmuchmail.org \
    /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://yhetil.org/notmuch.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).