Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot pipe </dev/null for message body #2243

Closed
noahrama opened this issue Apr 7, 2020 · 3 comments · Fixed by #2244
Closed

cannot pipe </dev/null for message body #2243

noahrama opened this issue Apr 7, 2020 · 3 comments · Fixed by #2244
Labels
bug:confirmed A NeoMutt developer can repeat this issue bug:regression A bug that was fixed is broken again

Comments

@noahrama
Copy link

noahrama commented Apr 7, 2020

Expected Behaviour

i should be able to:
mutt -s 'test' email@email.com </dev/null

Actual Behaviour

when i pipe </dev/null, it fails

Steps to Reproduce

mutt -s 'test' email@email.com </dev/null
with version > NeoMutt 20191207

How often does this happen?

  • Always

When did it start to happen?

  • When I upgraded from NeoMutt 20191207

NeoMutt Version

latest
NeoMutt 20200320
Copyright (C) 1996-2016 Michael R. Elkins and others.
NeoMutt comes with ABSOLUTELY NO WARRANTY; for details type 'neomutt -vv'.
NeoMutt is free software, and you are welcome to redistribute it
under certain conditions; type 'neomutt -vv' for details.

System: Linux 5.6.2-arch1-2 (x86_64)
ncurses: ncurses 6.2.20200212 (compiled with 6.2.20200212)
libidn2: 2.3.0 (compiled with 2.3.0)
GPGME: 1.13.1
GnuTLS: 3.6.12
libnotmuch: 5.2.0
hcache backends: kyotocabinet, gdbm, lmdb
hcache compression: lz4, zlib, zstd

Configure options: --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --gpgme --sqlite --autocrypt --lua --notmuch --gss --gnutls --sasl --with-ui=ncurses --with-idn2=/usr --disable-idn --idn2 --lmdb --kyotocabinet --gdbm --lz4 --zlib --zstd

Compilation CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -std=c99 -D_ALL_SOURCE=1 -D_GNU_SOURCE=1 -D__EXTENSIONS__ -I/usr/include -DNCURSES_WIDECHAR

Default options:
+attach_headers_color +compose_to_sender +compress +cond_date +debug
+encrypt_to_self +forgotten_attachments +forwref +ifdef +imap +index_color
+initials +limit_current_thread +multiple_fcc +nested_if +new_mail +nntp +pop
+progress +quasi_delete +regcomp +reply_with_xorig +sensible_browser +sidebar
+skip_quoted +smtp +status_color +timeout +tls_sni +trash

Compile options:
+autocrypt +bkgdset +color +curs_set +fcntl -flock -fmemopen +futimens
+getaddrinfo +gnutls +gpgme +gss +hcache -homespool +idn +inotify
-locales_hack +lua +lz4 +meta -mixmaster +nls +notmuch -openssl +pgp +sasl
+smime +sqlite +start_color +sun_attachment +typeahead +zlib +zstd
MAILPATH="/var/mail"
PKGDATADIR="/usr/share/neomutt"
SENDMAIL="/usr/sbin/sendmail"
SYSCONFDIR="/etc"

To learn more about NeoMutt, visit: https://neomutt.org
If you find a bug in NeoMutt, please raise an issue at:
https://github.com/neomutt/neomutt/issues
or send an email to: neomutt-devel@neomutt.org

Extra Info

Linux Archlinux 5.6.2-arch1-2 #1 SMP PREEMPT Sun, 05 Apr 2020 05:13:14 +0000 x86_64 GNU/Linux

@gahr
Copy link
Member

gahr commented Apr 7, 2020

The regression was introduced by b113e9e#diff-c24730921dd546803ed551b31edd2cb0R2170 - if we can't read at least one byte from stdin, we fail. @flatcap why? :)

@gahr gahr added bug:confirmed A NeoMutt developer can repeat this issue bug:regression A bug that was fixed is broken again labels Apr 7, 2020
@flatcap
Copy link
Member

flatcap commented Apr 7, 2020

Issue #2138 led me to fixes #2143 and #2177

They wanted NeoMutt to fail rather than send an empty email.
You want NeoMutt to send an empty email rather than failing.

Hmm...

@flatcap
Copy link
Member

flatcap commented Apr 7, 2020

I've been carefully re-reading the code and trying some experiments.
Unfortunately, I can't distinguish between the two cases:

  • Failed xdg-open (with no terminal)
  • CLI NeoMutt using /dev/null

The first case, caused by a mis-configuration, sends out an empty email.
I'd like to avoid this, if possible.

Using /dev/null, has a reasonable use-case, e.g. sending automated notifications, but it also has a simple workaround:

echo | neomutt -s "subject" user@example.com

I'll add an error message to make this clearer.

flatcap added a commit that referenced this issue Apr 7, 2020
Issue #2243 wants to send empty emails, but that conflicts with issue 2138
where empty emails were being sent by mistake.

For now, disallow: `neomutt user@example.com < /dev/null`
in favour of:      `echo | neomutt user@example.com`

Add an error message to suggest this behaviour.

Closes: #2243
flatcap added a commit that referenced this issue Apr 7, 2020
Issue #2243 wants to send empty emails, but that conflicts with issue 2138
where empty emails were being sent by mistake.

For now, disallow: `neomutt user@example.com < /dev/null`
in favour of:      `echo | neomutt user@example.com`

Add an error message to suggest this behaviour.

Closes: #2243
flatcap added a commit that referenced this issue Dec 12, 2023
Piping /dev/null to neomutt(1) can be useful; especially for debugging
purposes.

The original behavior, which comes from mutt(1), was to accept that.
Later, we disallowed an empty stdin, to workaround a bug in xdg-open(1)
(see issue #2138).

This commit reverts to the original behavior.  The xdg-open(1) bug
should be fixed in xdg-open(1) (and it probably has been fixed already,
because I haven't been able to reproduce it, although I haven't tested
it thoroughly).

Fixes: 331702b ("abort if run without a terminal")
Fixes: b113e9e ("fix command line sending")
Link: <#2138>
Link: <#2143>
Link: <#2176>
Link: <#2177>
Closes: <#2243>
Link: <#2244>
Link: <#4113>
Link: <#4116>
Cc: <https://github.com/The-Compiler>
Cc: Austin Ray <austin@austinray.io>
Cc: Pietro Cerutti <gahr@gahr.ch>
Reported-by: <https://github.com/noahrama>
Reported-by: Alejandro Colomar <alx@kernel.org>
Co-developed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Co-developed-by: Richard Russon (@flatcap) <rich@flatcap.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:confirmed A NeoMutt developer can repeat this issue bug:regression A bug that was fixed is broken again
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants