Bug 33001 - fails to build with dnotify but no inotify: undefined bus_set_watched_dirs
Summary: fails to build with dnotify but no inotify: undefined bus_set_watched_dirs
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: 1.2.x
Hardware: Other Linux (All)
: low normal
Assignee: Havoc Pennington
QA Contact: John (J5) Palmieri
URL:
Whiteboard: patch needs debugging
Keywords:
: 66238 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-01-11 10:27 UTC by Peter O'Gorman, The Written Word, Inc.
Modified: 2013-06-28 11:03 UTC (History)
5 users (show)

See Also:
i915 platform:
i915 features:


Attachments
patch to update dnotify watch (4.76 KB, patch)
2011-01-12 11:47 UTC, Peter O'Gorman, The Written Word, Inc.
Details | Splinter Review
[PATCH] dir-watch: remove dnotify backend (9.48 KB, patch)
2013-06-28 01:59 UTC, Chengwei Yang
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Peter O'Gorman, The Written Word, Inc. 2011-01-11 10:27:45 UTC
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 @@
 #endif
 
 #include <dbus/dbus-internals.h>
+#include <dbus/dbus-list.h>
 #include "dir-watch.h"
 
 #define MAX_DIRS_TO_WATCH 128
@@ -91,3 +92,16 @@
   
   num_fds = 0;
 }
+
+void
+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);
+    }
+}
+
+
Comment 1 Peter O'Gorman, The Written Word, Inc. 2011-01-11 16:25:11 UTC
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
Comment 2 Peter O'Gorman, The Written Word, Inc. 2011-01-12 11:47:48 UTC
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"
Sending HelloFromSelf
Sent HelloFromSelf
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
  ./bus-test(_dbus_print_backtrace+0x1c) [0x48b5fc]
  ./bus-test(_dbus_abort+0xd) [0x485f31]
  ./bus-test(_dbus_warn+0x105) [0x471d83]
  ./bus-test [0x43b2db]
  ./bus-test [0x43b33c]
  ./bus-test(main+0x1d5) [0x43b513]
  /lib64/tls/libc.so.6(__libc_start_main+0xd7) [0x2a958d61d7]
  ./bus-test(readdir_r+0x42) [0x4144da]
  Process 13922 sleeping for gdb attach
Comment 3 Simon McVittie 2012-06-05 03:48:17 UTC
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.
Comment 4 Simon McVittie 2013-06-27 10:33:34 UTC
*** Bug 66238 has been marked as a duplicate of this bug. ***
Comment 5 Simon McVittie 2013-06-27 10:39:41 UTC
(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 :-)
Comment 6 Colin Walters 2013-06-27 14:42:57 UTC
(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.
Comment 7 Chengwei Yang 2013-06-28 01:59:42 UTC
Created attachment 81598 [details] [review]
[PATCH] dir-watch: remove dnotify backend
Comment 8 Simon McVittie 2013-06-28 11:03:33 UTC
(In reply to comment #7)
> [PATCH] dir-watch: remove dnotify backend

Applied for 1.7.6. No more dnotify \o/


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.