Page MenuHome GnuPG

IPC syntax error when `gpg` starts `gpg-agent` without `$TERM` variable
Closed, ResolvedPublic

Description

For example, if gpg is used as part of a script executed from a window manager (e.g. passmenu or rofi-pass) the $TERM variable may not be set due to the window manager not being executed from within a shell (e.g. started from a display manager like LightDM). This should still allow us to access the GUI pinentry dialog.

When running gpg/gpg-agent without $TERM:

$ gpgconf --kill gpg-agent
$ echo | TERM= gpg --clearsign
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


gpg: signing failed: IPC syntax error
gpg: [stdin]: clear-sign failed: IPC syntax error

Running gpg/gpg-agent with $TERM:

$ gpgconf --kill gpg-agent
$ echo | TERM=xterm gpg --clearsign
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256



[opens pinentry dialog as expected]

OS: NixOS
gnupg: 2.2.9
pinentry: 1.1.0

Details

Version
2.2.9

Revisions and Commits

Event Timeline

werner removed a project: pinentry.
werner added a subscriber: werner.

Actually it fails only when you set TERM to the empty string. Unsetting TERM still works:

$ sh
$ gpgconf --kill gpg-agent
$ unset TERM
$ echo | gpg --clearsign

We can't add a fix for that in pinentry because the libassuan option handler emits the error. Thus it needs to be fixed in gnupg. Thanks for the report.

In any case I would strongly recommend to always set TERM to vt100 or any other common values.

gniibe claimed this task.
gniibe added a subscriber: gniibe.

Fixed in master (to be 2.3).