Bug 23925

Summary: DBus Daemon fails to detect newly installed .service files after it is started
Product: dbus Reporter: George Goldberg <grundleborg>
Component: coreAssignee: Havoc Pennington <hp>
Status: RESOLVED FIXED QA Contact: John (J5) Palmieri <johnp>
Severity: normal    
Priority: medium CC: smcv, tiagomatos, walters
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: monitor service directories for changes

Description George Goldberg 2009-09-14 05:06:36 UTC
If I compile and install a program that installs a .service file so that it can be autostarted by dbus, it is not included in the result of a subsequent call to org.freedesktop.DBus.ListActivatableNames until I either call org.freedesktop.DBus.ReloadConfig or restart the dbus daemon.
Comment 1 John (J5) Palmieri 2009-09-14 10:36:56 UTC
What platform are you on and did you enable dnotify, inotify or kqueue for monitoring directory changes?

Comment 2 John (J5) Palmieri 2009-09-14 10:37:41 UTC
Or rather does your platform compile d-bus with one of those features enabled?
Comment 3 George Goldberg 2009-09-14 13:45:38 UTC
I'm running Debian Linux unstable (on AMD64 platform), using stock distribution packages.

From looking at the buildd logs, it looks like the package is build with the following ./configure flags: 

/build/buildd/dbus-1.2.16/./configure --build=x86_64-linux-gnu --prefix=/usr --includedir="\${prefix}/include" --mandir="\${prefix}/share/man" --infodir="\${prefix}/share/info" --sysconfdir=/etc --localstatedir=/var --libexecdir="\${prefix}/lib/dbus-1.0" --disable-maintainer-mode --disable-dependency-tracking --srcdir=.   --enable-xml-docs --enable-doxygen-docs 

If there's any more information I can provide, please let me know.
Comment 4 Simon McVittie 2009-09-14 13:46:01 UTC
Debian appears to run ./configure with no special arguments (regarding inotify etc. at least), which in practice results in inotify being chosen on Linux: e.g. <https://buildd.debian.org/fetch.cgi?&pkg=dbus&ver=1.2.16-2&arch=amd64&stamp=1247704719&file=log>, <https://buildd.debian.org/fetch.cgi?&pkg=dbus&ver=1.2.1-3&arch=i386&stamp=1217461701&file=log> (reached from <https://buildd.debian.org/pkg.cgi?pkg=dbus>)
Comment 5 Colin Walters 2010-02-16 08:51:09 UTC
Yes, this is a bug it appears; we need to call get_servicedirs in bus.c and add them to the monitored directories.
Comment 6 Colin Walters 2010-02-18 13:11:24 UTC
Created attachment 33400 [details] [review]
monitor service directories for changes

Tested manually; adding infrastructure to this kind of thing to the test suite would be useful but a little nontrivial.
Comment 7 Will Thompson 2010-02-18 14:33:48 UTC
Comment on attachment 33400 [details] [review]
monitor service directories for changes

This looks fine to me! (Modulo inotify_add_watch() not being documented to raise ENOENT if the target doesn't exist, but I'm quite happy to believe that it does.)
Comment 8 Simon McVittie 2011-01-10 06:56:48 UTC
Already fixed: Colin seems to have committed this before 1.2.22.
Comment 9 Simon McVittie 2013-09-03 19:20:28 UTC
*** Bug 23921 has been marked as a duplicate of this bug. ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.