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 7AEED6DE0F32 for ; Tue, 3 Dec 2019 11:20:35 -0800 (PST) Authentication-Results: arlo.cworth.org; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="MCpjYvTE"; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.201 X-Spam-Level: X-Spam-Status: No, score=-0.201 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-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 2TmiKfBM61n1 for ; Tue, 3 Dec 2019 11:20:34 -0800 (PST) X-Greylist: delayed 311 seconds by postgrey-1.36 at arlo; Tue, 03 Dec 2019 11:20:33 PST Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by arlo.cworth.org (Postfix) with ESMTPS id 195676DE0F28 for ; Tue, 3 Dec 2019 11:20:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1575400830; bh=AejCvK3dRb8LAu5kt0XcsSw/MSvKXqxceY4rsezgBqM=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:Date; b=MCpjYvTEKoq2fw3ZDWjDnlUaavbqYaKDHPnXk3xWVOuiQ4xBEYdBjQL9cdV75+6kY OY6e8eNQXzNYBiT9LR8RvBpISPrH1ylNmEZAAR7xp19VKg9jMOCxqqxBTqoDPir4MY xvBafcM4wDAuWgid5DV5Imd7o15qz/WmXrUCdgdo= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from len.workgroup ([79.140.179.140]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MGyxN-1iXUnX3GfT-00E9XN; Tue, 03 Dec 2019 20:15:08 +0100 From: Gregor Zattler To: David Edmondson , notmuch Cc: Stefan Monnier Subject: Re: [BUG] notmuch-emacs: spoils sendmail -f with emacs 27 commit 3a59cc84069376802ba8fd731b524d78db58262c and later In-Reply-To: Mail-Followup-To: David Edmondson , notmuch , Stefan Monnier Date: Tue, 03 Dec 2019 20:15:02 +0100 Message-ID: <87wobdz0eh.fsf@len.workgroup> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:kxCAZtPoWfUo1W/Z+9E2+Bw3kqV4t2Ql8MB0NfUBYcd2JE0OlZg /q7HDkY3DmoTHKbQh7woEWBkzoggapvWXt9BxTMWjD8p5P+pWpTqEVjzwXbrgsPPi2N8Uga mZAbIMs3ib+AwXUHa7cY7E/7kIZZBmPQatSr7V8GObcWBaxmyXbagYcdlZuwMKuVqTQO90s AKJUq9g/VpHF6NHXfIRkA== X-UI-Out-Filterresults: notjunk:1;V03:K0:OMUcIiRxW18=:htlpxuI3biELn7hEJkIyK5 y96cdcQV+In1vjSodJkM2eP+b4E3xdIts6YzttwRGtIODy05ctAfkovQGEtT17HQRRRPt75F2 agn2a1opmKEkQa1uNfXPNX/UPIxZJrjX1ebYfuw3YBGOF+2cSBFr7u2wbnfJv8aPBVXod/hzR 8EUyshj+IpGJxgCPr0/o1dU7xJeiZXHC9s+nedNEh2TftKaALgYYUM5CcfX6q8Jfn1madkIHZ iEMxjVlCXJe48HKPUIitwse5wUxcB+eO4SxhvMLlvQR6W3r+bnv2iaAyYef5cgJopVTpKuNtD EB5OMryNk7ZZLGHZ6DDnsfHsESTmnHcdypkavJzLRJN3tX0nBzb8D7Zy6xHKT7kOifG9V+2q3 keyaycBUI/QvXo1qNFaBAhIapXAAyCahFU+sC2jt1Yqupdo/eYsr7pyCatPp60zLSMd7jo5tJ xcygPDOIQLgGePgsCRKVmrDbeeYJYWGMXahDRBF9sVKjZMHHPozg/nQ7A33Bj0gBCDLhMV4TI D7dDx5NCSzMtySAqlrzB4l/+hoUMxOevPQEZh2/IJRX+Byl7w9d4XBY+Qyv3cwtABlsU9Kx9a lhKmEAwZ7owXg6ln+/9Uhj6sEu3/xMTQfVUqaOC9T0kISuZCMk3D8NoTUlVaVoRB6oDb2brqF mQbvn9wUATNg93u+yO4C9GIIfO75ZVl3VNDVYCD5OCVbVhctzChHOld85ymYQSl4kH3EzkEo5 VgG1CB71vjLUp0rYQFsqiEICcd77u6aMzwro5DCAR5gXDCM0AoU4inigFPB9XhQc+YyIa1zo3 L7Ta4UdFtklSlNNBbUPr79yJqxpYqzmRYGBAEAhia9G2clN708Kb8MaTPmoCGfNnP7tCB2lPT gau6bwCYuSeK+dFPim4++Jb9b67sUdgOGOodmBCwPYmb6hZuGq1AoblbyVr7fmYEgfMkYZ6kw R4PVjH9JOJtWxhUGtci/7nLWfwE8UjBuN9v6dj40VpHz1mDc6W3n/pYoE4oj89KYhNOS376/O Wfjl3Bns7v0t2tHMZbPKi+RpAZPvywlHweDWNSHsG0XwTgwUmIMzZ2a8Ciq/6vjbSKBG935QD rKOVvi7oEaYd0uXQxIVVLmNzi13PH4s7ZaC1kFEFKuiUM2qL7ywnuiru+Qr/siCFOVhwnCgnH kR+8vZJ09b6U36fZLo1bi0vtEMGn2QGBoPqjtI0hGdqsxkF0AfDrqHfIwsrmDna4WLc+BTEfW KfSuD8phYf3txNKqiCy38HcKIVP0QWVp+IgzU1FZLDW3h20D1DUeBTUmyGag= 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 19:20:35 -0000 Hi David, * David Edmondson [2019-12-03; 18:43]: > On Sunday, 2019-12-01 at 18:10:59 +01, Gregor Zattler wrote: >> 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-m= acro): 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` tes= ts >> for libs distributed with Emacs. >> (message-use-send-mail-function): New function. >> (message-default-send-mail-function): Default to it, and remove cas= es >> 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 av= ailable. >> (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 'n= otmuch)" -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. >> (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, = though. OK, thanks. >> (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 (requi= re '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 = mail-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 astonishing, since my test script behaves different with emacs build with different last commits!? > 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'. At the moment I cannot follow... > message.el is being loaded by =E2=80=9C(require 'notmuch)=E2=80=9D in you= r example, > which is happening before `mail-specify-envelope-from' is set, so you > see the failure mode described. ... but in my example the setq forms precede every call to message/notmuch (as in your example)!? [And in my emacs configuration the customizations made with emacs' customization interface (among others the three variables which are setq in my test script) are loaded before almost anything else, especially message/notmuch, see below] > The example you provided is obviously contrived to show the problem - > are you hitting it in normal use? Absolutely. I struggle with this at least since 2nd of August and have reproduced this behaviour dozens of times. It took my several attempts to isolate the problem. I use https://github.com/xundeenergie/exim4-multiaccount version 1.57 as of 2018-06-05 in order to send emails through different smarthosts. I do this every day and with emacs from sources newer than commit 01739625704aaaea6831cef459a4a53171689513 I'm e.g. not able to send emails with my work email address ot to this mailing list. This is especially annoying since sending fails silently. So relatively important emails as e.g. announcements of downtimes did not reach their intended audience. The whole thing is above my elisp knowledge. Is it possible you describe something which is not the problem I described? Ciao; Gregor --=20 -... --- .-. . -.. ..--.. ...-.-