Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to send signals from a D-Bus service I own #2770

Closed
Tamaranch opened this issue Jan 14, 2022 · 14 comments
Closed

Unable to send signals from a D-Bus service I own #2770

Tamaranch opened this issue Jan 14, 2022 · 14 comments

Comments

@Tamaranch
Copy link

Maybe related to flatpak/xdg-dbus-proxy#25.

It works with --socket=session-bus, but I don't know what permission to add besides that to make it work. Normally there should be no need for anything since the service name derives from my application name: org.xfce.ristretto -> org.xfce.ristretto.Thumbnailer1.

But I can't update my application with --socket=session-bus: flathub/org.xfce.ristretto#7

bwrap: Can't find source path /run/flatpak/bus: No such file or directory

Here is an extract of the logs when running with --log-session-bus:

C20: -> :1.129 signal org.xfce.ristretto.Thumbnailer1.Started at /org/xfce/ristretto/Thumbnailer1
*DENIED*
C21: -> :1.129 signal org.xfce.ristretto.Thumbnailer1.Ready at /org/xfce/ristretto/Thumbnailer1
*DENIED*
C22: -> :1.129 signal org.xfce.ristretto.Thumbnailer1.Ready at /org/xfce/ristretto/Thumbnailer1
*DENIED*
C23: -> :1.129 signal org.xfce.ristretto.Thumbnailer1.Ready at /org/xfce/ristretto/Thumbnailer1
*DENIED*
C24: -> :1.129 signal org.xfce.ristretto.Thumbnailer1.Ready at /org/xfce/ristretto/Thumbnailer1
*DENIED*
C25: -> :1.129 signal org.xfce.ristretto.Thumbnailer1.Ready at /org/xfce/ristretto/Thumbnailer1
*DENIED*
C26: -> :1.129 signal org.xfce.ristretto.Thumbnailer1.Ready at /org/xfce/ristretto/Thumbnailer1
*DENIED*
C27: -> :1.129 signal org.xfce.ristretto.Thumbnailer1.Ready at /org/xfce/ristretto/Thumbnailer1
*DENIED*
C28: -> :1.129 signal org.xfce.ristretto.Thumbnailer1.Ready at /org/xfce/ristretto/Thumbnailer1
*DENIED*
C29: -> :1.129 signal org.xfce.ristretto.Thumbnailer1.Ready at /org/xfce/ristretto/Thumbnailer1
*DENIED*
C30: -> :1.129 signal org.xfce.ristretto.Thumbnailer1.Ready at /org/xfce/ristretto/Thumbnailer1
*DENIED*
C31: -> :1.129 signal org.xfce.ristretto.Thumbnailer1.Finished at /org/xfce/ristretto/Thumbnailer1
*DENIED*
Tamaranch added a commit to Tamaranch/org.xfce.ristretto that referenced this issue Jan 15, 2022
This makes the Flatpak application self-contained from a thumbnail
perspective, as it was already from a configuration perspective. Since
thumbnails are no longer searched in `~/.cache` but in
`$XDG_CACHE_HOME`, and the thumbnailing service name must be
configurable at build time, Ristretto 0.12.2 is needed for this to work
properly.

Changes commited upstream in:
https://gitlab.xfce.org/xfce/tumbler/-/commit/b075248d977a6491a6f0f63f5bc67cdb16c3a0f8
https://gitlab.xfce.org/xfce/tumbler/-/commit/7c7bd60f329e351ebdc02c5268364539d8197d29

A patch has also been added temporarily to Ristretto to overcome a
problem of signal emission from Tumbler. See the message of this patch
and:
flathub/flathub#2770
flathub#7
Tamaranch added a commit to flathub/org.xfce.ristretto that referenced this issue Jan 15, 2022
This makes the Flatpak application self-contained from a thumbnail
perspective, as it was already from a configuration perspective. Since
thumbnails are no longer searched in `~/.cache` but in
`$XDG_CACHE_HOME`, and the thumbnailing service name must be
configurable at build time, Ristretto 0.12.2 is needed for this to work
properly.

Changes commited upstream in:
https://gitlab.xfce.org/xfce/tumbler/-/commit/b075248d977a6491a6f0f63f5bc67cdb16c3a0f8
https://gitlab.xfce.org/xfce/tumbler/-/commit/7c7bd60f329e351ebdc02c5268364539d8197d29

A patch has also been added temporarily to Ristretto to overcome a
problem of signal emission from Tumbler. See the message of this patch
and:
flathub/flathub#2770
#7
@barthalion
Copy link
Member

Please don't add --socket=session-bus. It's unlikely to be a solution for your problem.

The infra issue that caused said build failure has been fixed with flathub/org.flatpak.Builder#70. As you now bundled Tumbler, is there anything actionable left?

@Tamaranch
Copy link
Author

Tamaranch commented Jan 25, 2022

Please don't add --socket=session-bus. It's unlikely to be a solution for your problem.

This is the only real solution I have found so far. Since I couldn't get it to build on Flathub, I had to patch Ristretto itself in the meantime, to make up for Tumbler's inability to emit signals.

But that's just temporary. The real solution would be to find the appropriate permissions for Tumbler, or to fix the bug on the Flatpak side if there is one. Because I don't see why a service owned by the main application (here Ristretto) should need special permissions to emit signals.

If it's possible to set --socket=session-bus now, I'd be tempted to do it: it seems better than having to patch Ristretto, even if it's probably not as good from an isolation point of view.

@Tamaranch
Copy link
Author

Tamaranch commented Jan 25, 2022

Indeed, it builds correctly with --socket=session-bus now: flathub/org.xfce.ristretto#13
I'm marking it as a draft until this discussion is over.

Tamaranch added a commit to Tamaranch/org.xfce.ristretto that referenced this issue Jan 25, 2022
@Tamaranch
Copy link
Author

Tamaranch commented Feb 1, 2022

@barthalion @bilelmoussaoui If you don't have a better suggestion, I would be for merging flathub/org.xfce.ristretto#13: it will always be better than a (rough) patch on the main application.

EDIT: merged :)

Tamaranch added a commit to flathub/org.xfce.ristretto that referenced this issue Feb 6, 2022
@gasinvein
Copy link
Member

What breaks from the UX perspective?
I don't see errors like these when just launching the app with --socket=session-bus perm revoked.

@Tamaranch
Copy link
Author

What breaks is thumbnail display (View -> Show Thumbnail Bar).
To get these errors, you have to run Tumbler by hand in another terminal (cleaning up first to do proper tests):

pkill tumblerd
rm -r ~/.var/app/org.xfce.ristretto/cache/thumbnails/*
/usr/bin/flatpak run --log-session-bus --branch=master --arch=x86_64 --command=/app/lib/tumbler-1/tumblerd org.xfce.ristretto

You will get some of these errors when you launch Ristretto, and then you will get more if you scroll the thumbnail bar. Of course you need to open a directory with enough images:

flatpak run org.xfce.ristretto ~/Images

@gasinvein
Copy link
Member

Hmm, this looks like flatpak/xdg-dbus-proxy#25 indeed.

@Tamaranch
Copy link
Author

@gasinvein So do you think that Ristretto could be added to the list of exceptions in #2785 until this problem is solved?

@gasinvein
Copy link
Member

It's not my call, but I personally believe this is not strong enough reason to make an exception and create a precedent.

@Tamaranch
Copy link
Author

Tamaranch commented Oct 24, 2022

I understand but then I don't see how I can unblock the situation for updates to Ristretto or its dependencies, as in flathub/org.xfce.ristretto#38.

I really don't see myself tinkering with a patch on the main app to fill the lack of a proper IPC between Ristretto and its thumbnailer So I guess it will stay stuck in its current state for lack of anything better.

@barthalion
Copy link
Member

@hadess
Copy link

hadess commented Nov 7, 2022

I can't reproduce the problem using:
flatpak run --command=bash -d --nosocket=session-bus --log-session-bus org.xfce.ristretto

C66: -> org.freedesktop.portal.Desktop call org.freedesktop.portal.FileChooser.OpenFile at /org/freedesktop/portal/desktop
B63330: <- :1.73 return from C66
B63332: <- :1.73 signal org.freedesktop.portal.Request.Response at /org/freedesktop/portal/desktop/request/1_6559/gtk155685763
C67: -> :1.6551 call org.xfce.ristretto.Xfconf.SetProperty at /org/xfce/ristretto/Xfconf
B100: <- :1.6551 return from C67
C68: -> :1.6555 call org.xfce.ristretto.Thumbnailer1.Queue at /org/xfce/ristretto/Thumbnailer1
B59: <- :1.6555 return from C68
B60: <- :1.6555 signal org.xfce.ristretto.Thumbnailer1.Started at /org/xfce/ristretto/Thumbnailer1
B61: <- :1.6555 signal org.xfce.ristretto.Thumbnailer1.Ready at /org/xfce/ristretto/Thumbnailer1
B62: <- :1.6555 signal org.xfce.ristretto.Thumbnailer1.Finished at /org/xfce/ristretto/Thumbnailer1

I don't think that we should add exception to D-Bus access checks unless the app is explicitly a D-Bus debugging tool.

@Tamaranch
Copy link
Author

Removing permissions via --nosocket=session-bus is not the same as removing them in the manifest in this case, perhaps because the main application is not itself the D-Bus service.
You need to remove --socket=session-bus from org.xfce.ristretto.yml and rebuild. Then you will have the problem.
See also #2770 (comment) about how to get the logs in this case.

@bbhtt
Copy link
Contributor

bbhtt commented Apr 7, 2024

Seems solved by having an exception for org.xfce.ristretto

@bbhtt bbhtt closed this as completed Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants