unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Matt Armstrong <matt@rfc20.org>
To: Justus Winter <justus@sequoia-pgp.org>, 56855@debbugs.gnu.org
Subject: bug#56855: 27.1; sendmail-send-it considers it an error if sendmail wrote to stdout/stderr
Date: Mon, 01 Aug 2022 13:46:15 -0700	[thread overview]
Message-ID: <87o7x34rqg.fsf@rfc20.org> (raw)
In-Reply-To: <87wnbtig4z.fsf@thinkbox>

Justus Winter <justus@sequoia-pgp.org> writes:

> sendmail-send-it considers it an error if sendmail wrote to
> stdout/stderr, despite the fact that the process returned success.

[...]

> I read documentation of various sendmail implementations, and all
> agreed that returning success meant that the operation succeeded.  I
> found no justification for emacs thinking that the operation failed if
> the process printed to stdout or stderr.

This is perhaps surprising.  It is also behavior that has come to be
expected, especially in more traditional Unix programs.  E.g. crontab
also considers jobs that print to stderr to have an error, regardless of
exit status.

From the sendmail(8) manpage we have this statement:

    Sendmail is not intended as a user interface routine; other programs
    provide user-friendly front ends; sendmail is used only to deliver
    pre-formatted messages.

An implementation of the "sendmail program" should probably emulate the
original sendmail as closely as possible.  It prints no messages when it
succeeds.

On this we do have roughly 35 years of historical precedent, since the
original Sendmail began in the mid-80s.  :-)

This may seem like a historical wart, but I have personally found this
behavior to be helpful, especially in programs that are typically run
non-interactively and "out of sight" like a crontab or sendmail wrapper
script.  E.g. when a shell script prints to stderr there may indeed have
been a problem, but a bug in the script may still have caused it to exit
with zero regardless.  It is usually easy to arange for such programs to
print nothing when they succeed.


> I use msmtp with the authentication password encrypted using OpenPGP.
> Then, I use 'gpg --no-tty -q -d ...' as msmtp's passwordeval function.
> Now, my OpenPGP key has expired, but that doesn't stop GnuPG from
> decrypting the secret, and in fact it returns the status code 0.  It
> also prints
>
>   gpg: Note: secret key 08CC70F8D8CC765A expired at Mon 25 Jul 2022 05:31:26 PM CEST
>
> to stderr, which is picked up by emacs, it says
>
>   sending...failed to gpg: Note: secret key 08CC70F8D8CC765A expired at Mon 25 Jul 2022 05:31:26 PM CEST
>
> in the status buffer while the compose buffer stays open.  Note that
> despite this, the message has been sent successfully, while emacs
> indicates that the sending has failed.

Can you configure your msmtp to behave like sendmail and refrain from
printing human readable messages upon success?  Perhaps the --logger-fd
or --logger-file arguments to gpg could be used to direct the output you
do not wish to read to /dev/null?





  reply	other threads:[~2022-08-01 20:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-31 13:08 bug#56855: 27.1; sendmail-send-it considers it an error if sendmail wrote to stdout/stderr Justus Winter
2022-08-01 20:46 ` Matt Armstrong [this message]
2022-08-02  5:59   ` Justus Winter
2022-08-02 10:44     ` Lars Ingebrigtsen

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://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87o7x34rqg.fsf@rfc20.org \
    --to=matt@rfc20.org \
    --cc=56855@debbugs.gnu.org \
    --cc=justus@sequoia-pgp.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://git.savannah.gnu.org/cgit/emacs.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).