Page MenuHome GnuPG

pinentry qt and fltk - fallback to tty on invalid DISPLAY
Open, NormalPublic

Description

Hello,
pinentry-gtk-2 falls back to displaying messages on the TTY if DISPLAY is set but inaccessible, i.e. when invoked like this:

env DISPLAY=invalid pinentry

-qt immediately exits with error in this scenario

ametzler@argenau:~$ env DISPLAY=invalid pinentry-qt
qt.qpa.xcb: could not connect to display invalid
qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, wayland, offscreen, linuxfb, wayland-egl, vnc, minimalegl, minimal, xcb, vkkhrdisplay.

Aborted                    env DISPLAY=invalid pinentry-qt

and -fltk exits with an error once it tries to access the display:

ametzler@argenau:~$ env DISPLAY=invalid pinentry-fltk
OK Pleased to meet you, process 7016
message
Can't open display: invalid
ametzler@argenau:~$ echo $?
1

Originally submitted here: https://bugs.debian.org/1129944

Details

Version
1.3.2

Event Timeline

ametzler1 added a project: pinentry.
ametzler1 updated the task description. (Show Details)

Afaict neither QT nor FLTK offer an equivalent to gtk-2's gtk_init_check() so there is no trivial change to get the same functionality.

I am pretty sure the heuristics used by pinentry-qt (5) are not correct ...

const bool hasWaylandDisplay = qEnvironmentVariableIsSet("WAYLAND_DISPLAY");
const bool isWaylandSessionType = qgetenv("XDG_SESSION_TYPE") == "wayland";
const bool hasX11Display = pinentry_have_display(argc, argv);
const bool isX11SessionType = qgetenv("XDG_SESSION_TYPE") == "x11";
const bool isGUISession = hasWaylandDisplay || isWaylandSessionType || hasX11Display || isX11SessionType;

... X11 does not work with $DISPLAY even if XDG_SESSION_TYPE=x11. $internetsearch suggests that XDG_SESSION_TYPE=wayland without WAYLAND_DISPLAY should fall back to a default and indeed work. So perhaps the hasX11SessionType should simply be removed.

gniibe mentioned this in Unknown Object (Maniphest Task).Mon, Mar 9, 2:40 AM

We talked about this in our developer meeting on Monday. I have never experienced the problem because I use the Qt version only on Windows and for my own use I use the Gtk version. In any case I think that Qt and fltk should fallback to curses to cover the case of using the Pinentry for a system startup on the console (e.g. the g13 case) with later switching to a GUI. And of course for those users who switch between GUI and console.