Hi, the attached piece of code deadlocks when called via sudo but works fine otherwise. This is probably caused by DBUS_SESSION_BUS_ADDRESS pointing to a socket for the session bus of the user calling sudo which is not owned by root. When using dbus_threads_init_default() or not initializing threads at all it doesn't deadlock but fails gracefully. Bye
Created attachment 7976 [details] test.c
This is btw with dbus 1.0.1 and dbus-glib 0.72.
I think J5 mentioned he had a fix for this.
One workaround is to use dbus_threads_init_default() instead of dbus_g_threads_init() since the internal thread implementation uses recursive threading and glib's uses non-recursive. dbus_g_threads_init should start to call dbus_threads_init_default() in the future. We should also fix this code to work with nonrecursive locks by dropping the lock whenever we call functions outside of bus.c that may call back into bus.c
Fixed in git head.
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.