Long story.
I'm migrating my desktop setup to wayland (ideally without xwayland running).
Previously under X, I had pinentry-program /usr/bin/pinentry-gtk-2. If I would ssh to this system and do something which made gpg-agent invoke (right?) the pinentry program, I would get pinentry-curses in my face and happily enter the passphrase.
I found that pinentry-qt works natively in wayland, and does fallback as well, so I got my above use-case working. Good!
But, in order to get screen sharing to work (relying on xdg-desktop-portal et al), I had to make my wayland compositor exec these:
systemctl --user import-environment WAYLAND_DISPLAY dbus-update-activation-environment WAYLAND_DISPLAY
(not entirely sure if WAYLAND_DISPLAY needs to be injected in both places, or in which if only one)
This broke pinentry-qt's fallback. My above use-case results in (when git trying to sign commit):
error: gpg failed to sign the data fatal: failed to write commit object
I'm not quite sure of how the calling of the pinentry program works, and why this confuses pinentry. git calls gpg which finds and talks to gpg-agent which invokes pinentry because it needs a passphrase? Does gpg advice gpg-agent about which pinentry to use? Since it could see WAYLAND_DISPLAY/DISPLAY, maybe whether user is on a tty, or so. Or is it more like the pinentry-program inheriting {WAYLAND_,}DISPLAY from gpg-agent, and "trying" to use them and then falling back...