On 2026-03-07 07:53:31 +0100, Andreas Metzler wrote:
> On 2026-03-07 Andreas Metzler <[email protected]> wrote:
> [...]
> > Are you running wayland instead of X11? In that case you would also need
> > to unset WAYLAND_DISPLAY.

I'm just under X11.

> Plus possibly XDG_SESSION_TYPE. The heuristics are a little bit strange

If I unset XDG_SESSION_TYPE (which is "x11" here), the problem
disappears in the case where DISPLAY is unset, i.e.

(1)
  env -u XDG_SESSION_TYPE -u DISPLAY pinentry-qt --help

gives the help text, but

(2)
  env -u XDG_SESSION_TYPE DISPLAY=invalid pinentry-qt --help

still terminates abnormally (aborts) without the help text.

>     const bool isX11SessionType = qgetenv("XDG_SESSION_TYPE") == "x11";
>     const bool isGUISession = hasWaylandDisplay || isWaylandSessionType || 
> hasX11Display || isX11SessionType;

In case (1), isGUISession is false, but if XDG_SESSION_TYPE is x11
or DISPLAY is set (valid or invalid), isGUISession is true. In this
latter case, if the display is unavailable, the abort occurs.

>     qCDebug(PINENTRY_LOG) << "hasWaylandDisplay:" << hasWaylandDisplay;
>     qCDebug(PINENTRY_LOG) << "isWaylandSessionType:" << isWaylandSessionType;
>     qCDebug(PINENTRY_LOG) << "hasX11Display:" << hasX11Display;
>     qCDebug(PINENTRY_LOG) << "isX11SessionType:" << isX11SessionType;
>     qCDebug(PINENTRY_LOG) << "isGUISession:" << isGUISession;
> #else
>     const bool isGUISession = pinentry_have_display(argc, argv);
> #endif
>     if (!isGUISession) {
>         pinentry_cmd_handler = curses_cmd_handler;
>         pinentry_set_flavor_flag ("curses");
> 
> ... I doubt it is possible to open an X11 window if DISPLAY is unset,
> even if XDG_SESSION_TYPE=x11.

I confirm. I think that the fallback to curses occurs too early.
Instead of aborting, pinentry-qt should fall back to curses at
this time.

-- 
Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)

Reply via email to