It appears that the addition of DBUS_SESSION_BUS_ADDRESS to the list of standard environment variables automatically passed from the client to gpg-agent (added by T3947) causes a regression for environments where the client does not have correct information about the environment in which pinentry will be launched.
An example of such an environment is an application running in a Flatpak container. When gpg is invoked from inside the container, its environment will contain DBUS_SESSION_BUS_ADDRESS=/run/flatpak/bus. This DBUS address is only valid within the container, but it will be passed to the gpg-agent running on the host system. pinentry is then launched by the agent on the host system with the same DBUS address in the environment and will fail to connect to DBUS, thereby failing to prompt the user for their pin.
This issue has been reported in the linked bug report (for Mozilla Thunderbird Flatpak) [1] [2] and also on the gnupg-users mailing list (for Evolution Flatpak) [3]. It is likely that any Flatpak application that packages gpg and communicates with a gpg-agent running on the host will experience this issue.
Steps to reproduce, without using Flatpak:
- Install gpg >= 2.3.0
- Create a signing key protected by a password
- Configure gpg-agent to use pinentry-gnome3
pinentry-program /usr/bin/pinentry-gnome3
- Simulate running gpg with an invalid DBUS_SESSION_BUS_ADDRESS in the environment:
DBUS_SESSION_BUS_ADDRESS=/run/flatpak/bus gpg --sign --armor
- pinentry-gnome3 is unable to connect to DBUS and so cannot prompt the user in their graphical environment. In this example, pinentry is able to fall back to the curses prompt in the terminal, but when running from inside a Flatpak, this fallback is not available and so no prompt is displayed to the user at all.
[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1931862
[2] https://github.com/flathub/org.mozilla.Thunderbird/issues/287
[3] https://lists.gnupg.org/pipermail/gnupg-users/2025-February/067500.html