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


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
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
Hash: SHA256

[opens pinentry dialog as expected]

gnupg: 2.2.9
pinentry: 1.1.0


Related Objects

Enzime created this task.Sep 10 2018, 1:47 PM
werner triaged this task as Low priority.Sep 10 2018, 3:24 PM
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.Jun 4 2019, 4:37 AM
gniibe closed this task as Resolved.
gniibe added a subscriber: gniibe.

Fixed in master (to be 2.3).