We are trying to build dbus-1.2.26, but looking at git, the same problem exists with 1.4.x.
RHEL 4 and other slightly older linux don't have inotify, so dbus uses dnotify and builds dir-watch-dnotify.c. Unfortunately this does not contain a bus_set_watched_dirs function, so linking fails.
This naive patch allows it to build, but I am doubtful that it is correct:
--- dir-watch-dnotify.c 2009-09-08 16:42:18.000000000 +0000
+++ dir-watch-dnotify.c 2011-01-11 18:06:48.645838358 +0000
@@ -32,6 +32,7 @@
#define MAX_DIRS_TO_WATCH 128
@@ -91,3 +92,16 @@
num_fds = 0;
+bus_set_watched_dirs (BusContext *context, DBusList **directories)
+ DBusList *link = _dbus_list_get_first_link (directories);
+ while (link != NULL)
+ bus_watch_directory(link->data, context);
+ link = _dbus_list_get_next_link (directories, link);
Patch is much too naive. This commit http://cgit.freedesktop.org/dbus/dbus/commit/?h=dbus-1.2&id=8a9880ffd2b81df38bb0e3492bda7a9636ac0280 should probably not have been backported to the 1.2 branch without also ensuring that dnotify support was also included.
Will try to find time to work on a complete patch
Created attachment 41932 [details] [review]
patch to update dnotify watch
This is a little better, make check reports a memleak, but I can't find it:
Echo service echoed string: "Test echo message"
Received the HelloFromSelf message
Reply from HelloFromSelf received
Shell echo service echoed the command line
./bus-test: checking for memleaks
1 dbus_malloc blocks were not freed
Process 13922 sleeping for gdb attach
RHEL 4 is pretty old; are Linux systems with dnotify but not inotify still interesting?
I'm tempted to say the solution should be to remove dnotify support in favour of "if you don't have inotify, you have to pkill -HUP dbus-daemon", since virtually nobody is going to be exercising the dnotify code path.
*** Bug 66238 has been marked as a duplicate of this bug. ***
(In reply to comment #0)
> RHEL 4 and other slightly older linux don't have inotify
At this point I would tend to categorize RHEL 4 as "extremely old Linux". inotify is present in Linux 2.6.13 (2005) and according to Wikipedia, RHEL 4 left "production" status over a year ago.
If the other D-Bus maintainers (particularly those who work for Red Hat...) don't object, I would be inclined to remove dnotify support altogether: in general, code that isn't tested doesn't work.
Chengwei Yang seems to be interested in fixing or deleting all our dead code and rarely-used code paths, which seems like a good opportunity to do this :-)
(In reply to comment #5)
> If the other D-Bus maintainers (particularly those who work for Red Hat...)
> don't object, I would be inclined to remove dnotify support altogether: in
> general, code that isn't tested doesn't work.
Fine by me; certainly at this point there is no way we'd rebase a new version of DBus onto RHEL4 - any patches would be backported.
Created attachment 81598 [details] [review]
[PATCH] dir-watch: remove dnotify backend
(In reply to comment #7)
> [PATCH] dir-watch: remove dnotify backend
Applied for 1.7.6. No more dnotify \o/