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

Exported D-Bus services not seen on installation #3145

Closed
owtaylor opened this issue Oct 1, 2019 · 2 comments · Fixed by #3148
Closed

Exported D-Bus services not seen on installation #3145

owtaylor opened this issue Oct 1, 2019 · 2 comments · Fixed by #3148

Comments

@owtaylor
Copy link
Contributor

owtaylor commented Oct 1, 2019

Testing with F30, dbus-broker:

$ flatpak install flathub org.gnome.Maps
$ gapplication launch org.gnome.Maps
error sending Activate message to application: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name is not activatable
$ sudo sh -c 'date > /var/lib/flatpak/exports/share/dbus-1/services/.changed'
$ gapplication launch org.gnome.Maps
<launches>

The problem here is that dbus-broker (and also dbus-daemon as far as I can tell from reading the code) watch service directories with:

        r = inotify_add_watch(dw->inotify_fd,
                              path,
                              IN_CLOSE_WRITE | IN_DELETE
                                             | IN_MOVED_TO
                                             | IN_MOVED_FROM);

Which does not notice new symlinks in a directory, since that's IN_CREATE. I'll file an issue against dbus-broker - whether they'll fix it or not may depend on how serious they are with bug-for-bug compatibility with dbus-daemon. It might make sense to put a workaround in Flatpak in any case.

@alexlarsson
Copy link
Member

I think we should just create the symlink with some temp name and move it into place. Should make it get the right event.

alexlarsson added a commit to alexlarsson/flatpak that referenced this issue Oct 2, 2019
Rather than unlinking and symlinking the new value we symling into
a temporary name and then atomically renames on top of the (possibly)
pre-existing file.

This has two advantages. First it is atomic, whereas the previous code
could end up removing the old code without creating the new one, and
secondly this will generate a move inotify event which is what dbus-broker
uses to detect changes in the services file directory.

Fixes flatpak#3145
@alexlarsson
Copy link
Member

I believe that PR should fix this, as it gives:

/home/alex/.local/share/flatpak/exports/share/applications/ OPEN,ISDIR 
/home/alex/.local/share/flatpak/exports/share/applications/ CREATE .export-symlink-6AHOii
/home/alex/.local/share/flatpak/exports/share/applications/ MOVED_FROM .export-symlink-6AHOii
/home/alex/.local/share/flatpak/exports/share/applications/ MOVED_TO org.gnome.gedit.desktop
/home/alex/.local/share/flatpak/exports/share/applications/ CLOSE_NOWRITE,CLOSE,ISDIR 

When installing gedit.

alexlarsson added a commit that referenced this issue Oct 2, 2019
Rather than unlinking and symlinking the new value we symling into
a temporary name and then atomically renames on top of the (possibly)
pre-existing file.

This has two advantages. First it is atomic, whereas the previous code
could end up removing the old code without creating the new one, and
secondly this will generate a move inotify event which is what dbus-broker
uses to detect changes in the services file directory.

Fixes #3145
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants