From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 6HnZHq0Y6GHdyQAAgWs5BA (envelope-from ) for ; Wed, 19 Jan 2022 14:57:01 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 6DJ9F60Y6GH/WgEAG6o9tA (envelope-from ) for ; Wed, 19 Jan 2022 14:57:01 +0100 Received: from mail.notmuchmail.org (yantan.tethera.net [135.181.149.255]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C1C9C38284 for ; Wed, 19 Jan 2022 14:57:00 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 3A8485F6DA; Wed, 19 Jan 2022 13:56:56 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id DAB235F6BE for ; Wed, 19 Jan 2022 13:56:53 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id 9CF0A5FC01; Wed, 19 Jan 2022 08:56:52 -0500 (EST) Received: (nullmailer pid 3264690 invoked by uid 1000); Wed, 19 Jan 2022 13:56:51 -0000 From: David Bremner To: Daniel Kahn Gillmor , Notmuch Mail Subject: Re: BUG: emacs: fcc duplicates messages with variant bodies due to mml security In-Reply-To: <87k1zm225v.fsf@fifthhorseman.net> References: <87k1zm225v.fsf@fifthhorseman.net> Date: Wed, 19 Jan 2022 09:56:51 -0400 Message-ID: <87v8yfvnfg.fsf@tethera.net> MIME-Version: 1.0 Message-ID-Hash: IKLCWXCOUOAE7QTUGP3BRCQAU2U4B3JP X-Message-ID-Hash: IKLCWXCOUOAE7QTUGP3BRCQAU2U4B3JP X-MailFrom: david@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1642600620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=Rus9FDi2rwT/f2IbbWyT8LkiX6O8INPS3BTdJqlSTKc=; b=Lb6J49n5pzVwVq1m5G4tnBDRsC6AtBgKH6f1JhpUm5xceHU6N3MQYSneMEOhNLanKQkE/1 y7WlzdecJeyG2x2B5mtcrZBThwyfJ6tDrFJvcQOststOXRw+k+wzC0BNSohCnyUVbeIshJ cx0427RqBfa7bgW2doUSIh5deTvGRM5KNAwQLZ1Rsy+ZhHlEFgk1bk3DCwB1U45Kd/jFtR Fdz4rfyyhpeFqwFtpyZpDlXyxE5EDnC0HkBKZHzTzCm0ZDJGk+BqjEeCDyNl2mM2RZvLhr CFm8qE7+RmQjF7VocLtTB5piSey+ViCZW88CRwpYDuzjWWarRkLLtJ40heMp5w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1642600620; a=rsa-sha256; cv=none; b=P9JuITYf9+r2sIckAwmlNLa+MUt2Cf2Z9MPlvRFGgSH4LeEsUhmkiXiE8aD5xUyWj2s62l vox+WprAQSB5qdlNkNejBpk4olIIzpoUV8Ku5IIYPBIpj00/2Np9baJCn8BJDs7MsMRkQn 9daQs7kISk8SdGqtpLeQeWPFFnNelqfOdTO7oFH7YSeJz0/5WTevypgNEtQHXweGZchLjt 3ThmKgFLvFAajUDPmjQjUq2ViCSQrOsb89gaFrSKVRABKxt/kQz0FPJLKS+zvIBRGUpX4K Odg/e6ZHqTU8jlpIR6WHQ4w6IfLpBbffCsDsrrSqHZR6HlOYrJFhF8N9kwBTYQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -2.35 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: C1C9C38284 X-Spam-Score: -2.35 X-Migadu-Scanner: scn1.migadu.com X-TUID: 38eHkJoRJKLw Daniel Kahn Gillmor 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))