Bug 420693 - URLs doesn't open if xdg-desktop-portal isn't started
Summary: URLs doesn't open if xdg-desktop-portal isn't started
Status: RESOLVED UPSTREAM
Alias: None
Product: neon
Classification: KDE Neon
Component: Snaps (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: VHI normal
Target Milestone: ---
Assignee: Scarlett Moore
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-28 06:03 UTC by Ilya Fedin
Modified: 2022-10-20 04:27 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ilya Fedin 2020-04-28 06:03:52 UTC
SUMMARY
For some reason snapd doesn't allow dbus activating of xdg-desktop-portal and returns AccessDenied to any request. Qt checks the returned error[1] and if it is not ServiceUnknown, Qt doesn't try to open URL through xdg-open, which encounters into situation that URLs doesn't open until some other app tries to access xdg-desktop-portal.

[1] https://github.com/qt/qtbase/blob/dev/src/platformsupport/services/genericunix/qgenericunixservices.cpp#L192

STEPS TO REPRODUCE
1. Don't have xdg-desktop-portal running
2. Open some URL through a snap based on kde-neon extension

OBSERVED RESULT
URL doesn't open

EXPECTED RESULT
URL opens in default browser

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE neon 5.18
(available in About System)
KDE Plasma Version: 5.18.4
KDE Frameworks Version: 5.69.0
Qt Version: 5.14.1

ADDITIONAL INFORMATION
Comment 1 Ilya Fedin 2020-04-28 06:24:39 UTC
KDE upstream bug
Comment 2 Ilya Fedin 2020-04-28 06:39:39 UTC
Oops, link to the Qt bug:
https://bugreports.qt.io/browse/QTBUG-81597
Comment 3 Nate Graham 2020-04-30 16:27:15 UTC
Even if I manually start xdg-desktop-portal-kde, this still happens for me. :(

Is this 100% an upstream Qt issue, or is there anything we can do on the KDE side? Did the KDE snap and flatpak packages just suddenly get an updated Qt to trigger this issue or something?
Comment 4 Ilya Fedin 2022-10-20 04:27:12 UTC
The bug I'm describing here was fixed on snapd side with https://github.com/snapcore/snapd/commit/d644659aa7f0605d6fcdfd80fa45d1a54bbfda8d long time ago.

If anyone is interesting why such kind of issues happen with Qt, but not gtk applications (xdg-desktop-portal is not the only problem here, I've also experienced such a problem with org.freedesktop.Notifications service on MATE systems), that's because glib's GDBusProxy class emits a org.freedesktop.DBus.StartServiceByName which is allowed by snapd, so it happens by the time a gtk application does request, the service is already started. Qt has nothing like this. So I'm wrapping D-Bus calls with StartServiceByName calls in my applications for them to work nicely with snapd. This is still required for any calls except of xdg-desktop-portal as this was fixed only for xdg-desktop-portal from snapd side.

But of course it doesn't mean opening files works with Qt and snap as there's still https://bugreports.qt.io/browse/QTBUG-83939, it's another bug though.