From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id C391E6DE0F22 for ; Tue, 3 Dec 2019 10:43:07 -0800 (PST) Authentication-Results: arlo.cworth.org; dkim=pass (2048-bit key; unprotected) header.d=dme-org.20150623.gappssmtp.com header.i=@dme-org.20150623.gappssmtp.com header.b="xwzhIuWY"; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.268 X-Spam-Level: X-Spam-Status: No, score=0.268 tagged_above=-999 required=5 tests=[AWL=-0.384, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_NEUTRAL=0.652, UNPARSEABLE_RELAY=0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4X0hVPbcocex for ; Tue, 3 Dec 2019 10:43:05 -0800 (PST) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by arlo.cworth.org (Postfix) with ESMTPS id 511996DE0F1C for ; Tue, 3 Dec 2019 10:43:05 -0800 (PST) Received: by mail-wr1-f68.google.com with SMTP id g17so5077133wro.2 for ; Tue, 03 Dec 2019 10:43:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dme-org.20150623.gappssmtp.com; s=20150623; h=to:cc:subject:in-reply-to:references:from:date:message-id :mime-version:content-transfer-encoding; bh=pzPLisDzGis4Uh4YjV9iqr2VASP+tS1jZ9tfgjSUYE8=; b=xwzhIuWYeLiTgdAhyOFJ4RyimKAN+DTiduoQNGcG+Oj9oLX46+kH+Nt3nVhBpdZEee IrbqfZVh269UdTy3M3PShrJa9qC9gNowJRWYkexLadJ6z15CwoDfHLJw22fVEM2Lpy4e 5DgsOMhlTV5PQkKJpaz6d7tD/2bf4sqmGzJDL58nRv84gPD/v3SZuNXHtv9yv4UH5iea Put5l1SE0uuZRYOW5at3YZ2rZa39qncHwV2+162TMqdYc44ytP7GV4KHDsR+DS5XrFQH 9sz+0kphzWKS6+HB+FgpqntRMF1E0lIIg9cxDRaI7MzmfiH0LF4AziJDTPLhCVCPKScB V2rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:subject:in-reply-to:references:from:date :message-id:mime-version:content-transfer-encoding; bh=pzPLisDzGis4Uh4YjV9iqr2VASP+tS1jZ9tfgjSUYE8=; b=dyCtvKtd7XGhdr3ZC8gjS32Sq+VXqjO3R7ZhfW2uNh/zBqXPHyWc9iwoqNbwbTr6vB E827exIbO8g5+4vR613UbDIwoneSTiXYkRvzCqHD+iUW129MPO8TFdNTXjw5F/roXXz3 lY5tZZNgtdpFSpr1y18lTrpb/yE2fHKFIIPcovJ2rg64a7+IhGcqUXHt54QoBKSIoSYi 4yqjqXXKZHnOQKUUZIxF82r2WIr+B2ayE5MMzi+dD35EgdgaKziQNSIDgnYshbhHlFgE qK3XpMLIgyFzjZF2n2s264ol1qQW2uo+hDUtYsJrhIAh7TulMqbTT7p1cHufTHzZaN+/ tkHg== X-Gm-Message-State: APjAAAWWbv9/TMN0AFfJvPM2Il+btgG5xcDY3E2YnQq9DanFQR1bkO3Z L5knPeb+PHzrRbmJMBQcqcKVOQ== X-Google-Smtp-Source: APXvYqxXFTmxpOcF3aP0Uk1g1niqfnV2sfCeAZ1dnECCHShHFa7vvGCdQfBnH17Td8rxOJ6chUCqww== X-Received: by 2002:adf:ee92:: with SMTP id b18mr2506167wro.281.1575398582441; Tue, 03 Dec 2019 10:43:02 -0800 (PST) Received: from disaster-area.hh.sledj.net (disaster-area.hh.sledj.net. [81.149.164.25]) by smtp.gmail.com with ESMTPSA id d8sm4631504wrx.71.2019.12.03.10.43.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 10:43:01 -0800 (PST) Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id d62d645b; Tue, 3 Dec 2019 18:43:00 +0000 (UTC) To: Gregor Zattler , notmuch Cc: Stefan Monnier Subject: Re: [BUG] notmuch-emacs: spoils sendmail -f with emacs 27 commit 3a59cc84069376802ba8fd731b524d78db58262c and later In-Reply-To: <87wobggee4.fsf@len.workgroup> References: <87wobggee4.fsf@len.workgroup> X-HGTTG: heart-of-gold From: David Edmondson Date: Tue, 03 Dec 2019 18:43:00 +0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:43:07 -0000 On Sunday, 2019-12-01 at 18:10:59 +01, Gregor Zattler wrote: > [@Stefan: FYI] > Dear notmuch developers, > > I use notmuch-emacs configured with > (setq mail-specify-envelope-from t) > (setq mail-envelope-from 'header) > (setq send-mail-function 'sendmail-send-it) > > this should/used to invoke sendmail (in my case exim4) with the email > address given in the From: header of the message buffer as > argument to sendmails -f option. Wow, this was, err, =E2=80=9Cinteresting=E2=80=9D. Comments below. > Since emacs 27 commit 3a59cc84069376802ba8fd731b524d78db58262c > > 3a59cc84069376802ba8fd731b524d78db58262c > Author: Stefan Monnier > AuthorDate: Tue Jul 30 16:37:01 2019 -0400 > Commit: Stefan Monnier > CommitDate: Tue Jul 30 16:37:01 2019 -0400 > > Parent: add146f09f * lisp/bindings.el (mode-line-defining-kbd-ma= cro): New defvar. > Contained: master > Follows: emacs-26.1 (6691) > > * lisp/gnus/message.el: Reduce redundancy with send-mail-function > > (message-send-mail-function) : Remove `local-library` tests > for libs distributed with Emacs. > (message-use-send-mail-function): New function. > (message-default-send-mail-function): Default to it, and remove cases > already handled by it. > (message--default-send-mail-function): New function. > (message-send-mail-function) : Use it as new default. > (message-sendmail-f-is-evil): Obey mail-specify-envelope-from if ava= ilable. > (message-check, message-with-reply-buffer): Use `declare`. > (message-smtpmail-send-it): smtpmail accepts mail-header-separator, > so simplify and declare obsolete. > (message-send-mail-with-mailclient): Declare obsolete. > (message-check-news-body-syntax): Don't presume that the checksum is > a fixnum. > > > this actually invokes sendmail -f with an address derived from the > EMAIL environment variable. > > > It took me some time to understand, that there is no problem with > compose-mail/message-send-and-exit which are bound to ^X m and ^C > ^C respectively within a barely configured emacs which I used for > testing. > If instead notmuch is loaded compose-mail/message-send-and-exit > and notmuch-mua-new-mail/notmuch-mua-send behave different. > > With this command (with test.el as attached): > > ~/src/emacs/src/emacs -Q -nw -l /tmp/test.el > > compose-mail/message-send-and-exit rightly show > -f example@example.org in the file /tmp/result (and then there is > an error because the notmuch commands are not known). > > While this command > > ~/src/emacs/src/emacs -Q -nw -L ~/src/notmuch/emacs/ --eval "(require 'no= tmuch)" -f notmuch -l /tmp/test.el > > wrongly show some other value for -f, depending on your EMAIL > environment variable, for both compose-mail/message-send-and-exit > and notmuch-mua-new-mail/notmuch-mua-send. > > > I read the code but I have no idea why and how to debug this. > > Ciao; Gregor > -- > -... --- .-. . -.. ..--.. ...-.- > > (find-file "/tmp/sent") > (insert "empty") > (kill-region (point-min) (point-max)) > (write-file "/tmp/sent") > (kill-buffer) > > (find-file "/tmp/result") > (kill-region (point-min) (point-max)) > (write-file "/tmp/result") > (kill-buffer) > > (find-file "/tmp/show-sendmail-args.sh") > (kill-region (point-min) (point-max)) > (insert "#!/bin/sh > echo $* >> /tmp/result") > (write-file "/tmp/show-sendmail-args.sh") > (chmod "/tmp/show-sendmail-args.sh" 448) > > (setq sendmail-program "/tmp/show-sendmail-args.sh") > (setq mail-specify-envelope-from t) > (setq mail-envelope-from 'header) > (setq send-mail-function 'sendmail-send-it) > > (compose-mail "Echo Mail Server " "test" > '((From: . "example@example.org"))) This example, and the one below, are broken - you can't use =E2=80=9CFrom:= =E2=80=9D here, it has to be =E2=80=9CFrom=E2=80=9D. Changing that doesn't fix it, th= ough. > (message-send-and-exit) > > (notmuch-mua-mail "Echo Mail Server " "test" > '((From: . "example@example.org"))) > (notmuch-mua-send-and-exit) > > (save-buffers-kill-terminal) As best I can determine, this relates to the order in which things are loaded. If you load message.el before setting `mail-specify-envelope-from', things are broken (sorry for the long lines): disaster-area ~/s/emacs % ./src/emacs -Q -nw -batch --eval "(progn (require= 'message) (setq mail-specify-envelope-from t mail-envelope-from 'header) (= message \"%s\" message-sendmail-envelope-from))" nil disaster-area ~/s/emacs %=20 ...but if you load it after, things work fine: disaster-area ~/s/emacs % ./src/emacs -Q -nw -batch --eval "(progn (setq ma= il-specify-envelope-from t mail-envelope-from 'header) (require 'message) (= message \"%s\" message-sendmail-envelope-from))" header disaster-area ~/s/emacs % This doesn't appear to be new behaviour - 26.1 does the same. This is related to the way that `message-sendmail-envelope-from' is initialised from `mail-envelope-from', and it's `message-sendmail-envelope-from' that matters, because you end up in `message-send-mail-with-sendmail'. message.el is being loaded by =E2=80=9C(require 'notmuch)=E2=80=9D in your = example, which is happening before `mail-specify-envelope-from' is set, so you see the failure mode described. The example you provided is obviously contrived to show the problem - are you hitting it in normal use? dme. --=20 Does everyone stare the way I do?