Hello,
I'm unable to send draft emails (created by `postpone`) due to a
segfault on aerc 0.17.0 +notmuch-5.6.0 (go1.21.5 amd64 linux ).
The crash log is attached. I believe this is caused by my convoluted use
of `outgoing-cred-command` which launches `pinentry-qt` to prompt for a
GPG key passphrase and subsequently return my mail password, which is
stored using `pass`[1]. The exact ritual I must perform is:
outgoing-cred-cmd = /usr/bin/echo -e "SETDESC GPG Key Authentication\nSETPROMPT Enter passphrase:\nGETPIN\n"|2>/dev/null pinentry-qt|rg -o '^D(.+)'|cur -d' ' -f2|pass posteo.de/adigitoleo
By contrast, for the source-cred-cmd it is sufficient for me to have
source-cred-cmd = pass posteo.de/adigitoleo
However, outgoing-cred-command cannot accept stdin from the aerc prompt,
hence the need for launching a GUI. Now, this is all fine when sending
emails quickly after opening aerc and without storing them as drafts.
However, it falls apart in two possibly related ways:
1) when sending an email after my gpg-agent has timed out, i.e. when I
need to re-enter my GPG key passphrase before sending, and
2) at any time, when trying to send a draft email
In the first case, I get an unresponsive TUI and must manually kill the
aerc process, after which my shell prompt remains mangled. In the second
case, I get a crash, which is what I am explicitly reporting here.
[1]: <https://www.passwordstore.org/>
Minor correction to the original report. My outgoing-cred-command,
without typos, is in fact:
outgoing-cred-cmd = /usr/bin/echo -e "SETDESC GPG Key Authentication\nSETPROMPT Enter passphrase:\nGETPIN\n"|2>/dev/null pinentry-qt|rg -o '^D(.+)'|cut -d' ' -f2|pass posteo.de/adigitoleo
So the crash is not caused by a syntax error here.
A quick update on this. I have found that the following outgoing-cred-cmd
allows me to safely send mail from the composer at any time, by correctly
setting up a pipeline from pinentry-qt to pass(1) to retrieve the SMTP
authentication credentials:
outgoing-cred-cmd = /usr/bin/echo -e "SETDESC GPG Key Authentication\nSETPROMPT Enter passphrase:\nGETPIN\n"|2>/dev/null pinentry-qt|rg -o '^D(.+)'|cut -d' ' -f2|PASSWORD_STORE_GPG_OPTS="--passphrase-fd=0" pass posteo.de/adigitoleo
The same thing at a pastebin: https://x0.at/gVbI.txt
The solution was to pipe the pinentry-qt output into
PASSWORD_STORE_GPG_OPTS="--passphrase-fd=0" pass ...
where the env var ensures that gpg looks for the passphrase on the correct file
descriptor. For anyone who wants to use pass for their aerc SMTP credentials,
the only part of that outgoing-cred-cmd that you should need to change is the
actual pass invocation, which for me was: pass posteo.de/adigitoleo (at the
end).
However, sending drafts still causes the crash. Below is a relatively terse
trace from the crash log. It looks like the problem occurs when trying to
return the account config. To reproduce: store your SMTP password with pass,
use the above mentioned outgoing-cred-cmd, open aerc, open a composer, enter
the TO: address, a subject line and a one-line body, run the :abort command and
pick the option to save as a draft (postpone), restart aerc, navigate to the
draft, open it in the pager, run the :send command.
Now that I think about it, perhaps I should be using :recall before :send. If
the crash persists when using :recall I will update this thread to clarify.
Version: 0.17.0 +notmuch-5.6.0 (go1.21.5 amd64 linux )
Error: runtime error: invalid memory address or nil pointer dereference
goroutine 1 [running]:
runtime/debug.Stack()
/usr/lib/go/src/runtime/debug/stack.go:24 +0x5e
git.sr.ht/~rjarry/aerc/log.PanicHandler()
/builddir/aerc-0.17.0/log/panic-logger.go:49 +0x66a
panic({0xaee940?, 0x10e9600?})
/usr/lib/go/src/runtime/panic.go:914 +0x21f
git.sr.ht/~rjarry/aerc/app.(*Composer).Config(...)
/builddir/aerc-0.17.0/app/compose.go:803
git.sr.ht/~rjarry/aerc/commands/compose.Send.Execute({{0x0?, 0x0?}, {0x0?, 0x455109?}}, {0x10?, 0xab39a0?, 0x1?})
/builddir/aerc-0.17.0/commands/compose/send.go:74 +0x9e
git.sr.ht/~rjarry/aerc/commands.ExecuteCommand({0xcbfe78?, 0xc0002d21c0}, {0xc0006ad870?, 0x20002ea000?})
/builddir/aerc-0.17.0/commands/commands.go:207 +0x437
main.execCommand({0xc0006ad868?, 0x4?}, 0xc0006ad868?, 0x0?)
/builddir/aerc-0.17.0/main.go:48 +0x3c
git.sr.ht/~rjarry/aerc/app.(*Aerc).BeginExCommand.func2({0xc0006ad868, 0x5})
/builddir/aerc-0.17.0/app/aerc.go:608 +0x2f
git.sr.ht/~rjarry/aerc/app.(*ExLine).Event(0xc00082e090, {0xcba020?, 0xc000b38120?})
/builddir/aerc-0.17.0/app/exline.go:90 +0xab
git.sr.ht/~rjarry/aerc/app.(*Aerc).Event(0xc000bbf2c0?, {0xcba020?, 0xc000b38120?})
/builddir/aerc-0.17.0/app/aerc.go:309 +0x427
git.sr.ht/~rjarry/aerc/lib/ui.HandleEvent({0xcba020?, 0xc000b38120?})
/builddir/aerc-0.17.0/lib/ui/ui.go:146 +0x148
main.main()
/builddir/aerc-0.17.0/main.go:279 +0x8e7
OK, it works fine if I first :recall the draft. Therefore, using
outgong-cred-cmd with pinentry-qt and pass is working. However, there is
an unrelated bug when using the :send command from the viewer/pager,
without doing :recall.
On Sat May 4, 2024 at 6:57 PM CEST, adigitoleo (Leon) wrote:
> outgoing-cred-cmd = /usr/bin/echo -e "SETDESC GPG Key Authentication\nSETPROMPT Enter passphrase:\nGETPIN\n"|2>/dev/null pinentry-qt|rg -o '^D(.+)'|cut -d' ' -f2|PASSWORD_STORE_GPG_OPTS="--passphrase-fd=0" pass posteo.de/adigitoleo
This is just wrong. Proper pass(1) configuration should be just something like
source-cred-cmd = pass show notes/thunderbird-imap.suse.de|head -n1
outgoing-cred-cmd = pass show notes/thunderbird-imap.suse.de|head -n1
and pass(1) (or respectively gpg2) should call your pinentry
program itself. You have somehow misconfigured security software,
which is always not a good idea.
Best,
Matěj
--
http://matej.ceplovi.cz/blog/, @mcepl@floss.social
GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8
Two things fill the heart with renewed and increasing awe and
reverence the more often and the more steadily that they are
meditated on: the starry skies above me and the moral law inside
me.
-- Immanuel Kant: Critique of Practical Reason
Thanks for the concern. However, the reason for doing it like this is
that my preferred default pinentry mode is 'loopback' (i.e. read
passphrase from stdin) and aerc doesn't allow reading stdin after using
:send. Therefore, I need to manually set up a pinentry-qt -> pass
pipeline.