Page MenuHome GnuPG

pinentry falls back to curses on wayland
Closed, ResolvedPublic

Description

On wayland, $DISPLAY might not be set, but pinentry-qt and pinentry-gnome3 fall back to curses if it isn't.

Event Timeline

werner triaged this task as Normal priority.Apr 17 2018, 7:55 PM
werner edited projects, added Feature Request, Wayland; removed Bug Report.
werner added a subscriber: werner.

Then please set DISPLAY ;-)

We need to have a way to figure out whether we are running on X or some X emulation. I change this to a feature request because pinentry behaves as designed.

Huh, can't believe I somehow missed that this actually got a reply three years ago...

Then please set DISPLAY ;-)

That only makes sense if an X11 display is actually available, which is not the case in all Wayland environments. Qt and GTK3 work fine without X11 though.

We need to have a way to figure out whether we are running on X or some X emulation. I change this to a feature request because pinentry behaves as designed.

Allowing pinentry-qt and gnome3 to start when either $DISPLAY or $WAYLAND_DISPLAY are set should work fine. Question is what to do with the --display option, which doesn't have a wayland equivalent. It might not be necessary to add that though.

ikloecker added a project: Restricted Project.
ikloecker moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.

Should now work for pinentry-qt on Wayland even if DISPLAY is not set.

pinentry-gnome3 does not rely on DISPLAY or WAYLAND_DISPLAY to figure out whether to use the curses fallback, so it should work for pinentry-gnome3 since some time already.

ikloecker moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Aug 2 2021, 5:41 PM

I gave it a try and it works here now with $DISPLAY unset, thanks!

I don't think it's necessary to check for $XDG_SESSION_TYPE, because that doesn't necessarily mean that a graphical display is available. For that, either $DISPLAY or $WAYLAND_DISPLAY needs to be set anyway.

I see some debug output when calling pinentry-qt manually:

hasWaylandDisplay: true
isWaylandSessionType: true
hasX11Display: false
isX11SessionType: false
isGUISession: true

QGuiApplication checks $XDG_SESSION_TYPE maybe to find out whether to use X11 or Wayland if $DISPLAY and $WAYLAND_DISPLAY are both set.

As far as I understood, $WAYLAND_DISPLAY does not need to be set because there is a well-defined default, but I guess most of the time it's set anyway.

I have added this debug output to ease debugging in case there are still problems for some people.

As far as I understood, $WAYLAND_DISPLAY does not need to be set because there is a well-defined default, but I guess most of the time it's set anyway.

Indeed, but I think the || isX11SessionType part is wrong because $DISPLAY is mandatory in that case.

I have added this debug output to ease debugging in case there are still problems for some people.

You could add a Q_LOGGING_CATEGORY with a default severity like Info, so those messages are only shown when the log level is set to debug. Otherwise the messages might end up in various log files.

@fvogt I've now added a logging category. Thanks for the suggestion.