From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id yLjvDBmlO1/GJgAA0tVLHw (envelope-from ) for ; Tue, 18 Aug 2020 09:53:29 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id kC/TCBmlO18jWwAA1q6Kng (envelope-from ) for ; Tue, 18 Aug 2020 09:53:29 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5D92A9402C2 for ; Tue, 18 Aug 2020 09:53:27 +0000 (UTC) Received: from [144.217.243.247] (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 5B78729BC4; Tue, 18 Aug 2020 05:53:17 -0400 (EDT) Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by mail.notmuchmail.org (Postfix) with ESMTPS id D252F27DBC for ; Tue, 18 Aug 2020 05:53:13 -0400 (EDT) Received: by mail-wr1-x429.google.com with SMTP id z18so17624979wrm.12 for ; Tue, 18 Aug 2020 02:53:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dme-org.20150623.gappssmtp.com; s=20150623; h=to:subject:in-reply-to:references:from:date:message-id:mime-version; bh=OtQXPoXrsHfmbCtm9esQQmLwGzqY6bIVk1Q0M4tzYGY=; b=mqt1vvG7PRiAzW+3PVd3WK9O1dR1gbNMGFz9WVsxIbD20EL4WGMXRtfPkGlzd9Ea/l lpKv90fkku173tNlwFmrF9W7NZzfT1GqvnnTVqQ8zN494ufgwAO6NIldcjA16GPp/UoL GKVkilpmm8j/glVybT2wiHdxq1dQse5Yeg+AWfkaAccI4NopssvQOiArxsL45Z2g1KOu j7fRKBXjwVPz9O1UzhZrEfYEkkVK0Xgs46K6sWeynKAvp8z0J88dSoAG20o9F3BKJ8ov 1CC6Sls6H21/zLTKpjw1eE4fbEa7C+FPoFF3AFmH9H98AKZ4nmVDlNMgWL4AuhOFuktA +ngA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:subject:in-reply-to:references:from:date :message-id:mime-version; bh=OtQXPoXrsHfmbCtm9esQQmLwGzqY6bIVk1Q0M4tzYGY=; b=E4lnFaz41Jq8wTomGQGHOMk42Ie+8xRTuflOsTfnQtSlYgsKvnxd0/lcPHbEde2qqS TIuXY4vXGBVfEojixQT+opkg/sHL8s5aIqpRaqMP3tuGYR7sH6gZb5mxgqqoypEyeteZ 1kc08m0b2JQqQWK5GxHrqTrcoNxGqShSOMAQAPF+tlXF1lbu4jU6ejXXZVH297O6Qu7T atxyc+Z4LPac33LQHke3+bU4gQK5SVwkRToSX3D762fo1IDXZItRJlycFxWfKmhhhwXZ 0a/jGMd+aXmIRY3aIB4SSeR2LqH5yRQuctyX4cEkzcJLdRvV2pr8CVD7wDWuz0HPpJ6x a3sg== X-Gm-Message-State: AOAM530n8WLlSTrFKql0SH2J/SHMjUkpE6/uwYlwUGzuPBUFX+G7xfUM QoVDkGWVmtqlZZHwIQl0kFIMgwHLLHHovmKk X-Google-Smtp-Source: ABdhPJzKbK0DzatnWf11hGznfiFNv3WxXZ6regzdMEVgqOsG01NtT2jYGM04A9du0y5OMPreI4HonA== X-Received: by 2002:adf:9ec5:: with SMTP id b5mr18371207wrf.190.1597744387650; Tue, 18 Aug 2020 02:53:07 -0700 (PDT) Received: from disaster-area.hh.sledj.net (8.a.e.d.0.0.0.0.0.0.0.0.4.6.0.0.0.4.1.7.1.7.b.b.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:bb71:7140:64::dea8]) by smtp.gmail.com with ESMTPSA id h7sm33020634wmf.43.2020.08.18.02.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2020 02:53:06 -0700 (PDT) Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 1d9a21b5; Tue, 18 Aug 2020 09:53:06 +0000 (UTC) To: Tim Quelch , notmuch@notmuchmail.org Subject: Re: emacs: `message-send-hook` being called twice In-Reply-To: <87mu2swv37.fsf@quelch.name> References: <87mu2swv37.fsf@quelch.name> X-HGTTG: heart-of-gold From: David Edmondson Date: Tue, 18 Aug 2020 10:53:05 +0100 Message-ID: MIME-Version: 1.0 Message-ID-Hash: 55P3ODJC4G6LU7UAFWYPFIBPFOWNJOTI X-Message-ID-Hash: 55P3ODJC4G6LU7UAFWYPFIBPFOWNJOTI X-MailFrom: dme@dme.org 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; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=dme-org.20150623.gappssmtp.com header.s=20150623 header.b=mqt1vvG7; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: 1.53 X-TUID: JVioYOd8df8s On Tuesday, 2020-08-18 at 12:23:24 +10, Tim Quelch wrote: > Hi all, > > I've been working through a bug that I've been having with org-msg > (https://github.com/jeremy-compostella/org-msg/issues/58#issuecomment-675177076) > and it looks like a bug in the internals of notmuch. > > It appears as though the `message-send-hooks` are being called twice, > 1. In `notmuch-mua-send-common` when `notmuch-mua-send-hook` are run > (which by default is set to `notmuch-mua-message-send-hook`, which just > runs `message-send-hook`) > 2. When `notmuch-mua-send-common` delegates sending of the message to > `message-send` or `message-send-and-exit`. These functions both run `message-send-hook` > > The specific issue this was causing in org-msg was that the message was > being converted to html twice, causing raw html to be included in the > sent message. This kind of issue could easily pop up again with other > non-idempotent hook functions. > > I was wondering what the design descision was to set up > `notmuch-mua-send-hook` to delegate to running `message-send-hook` when > this is already done in `message-send` Honestly, I don't remember. It was a long time ago. > If this was not intentional, I don't think `notmuch-mua-send-hook` needs > to contain `notmuch-mua-message-send-hook` by default. I agree that it's a bug - `notmuch-mua-message-send-hook' should probably just die. dme. -- Stop the music and go home.