dbus on macosx

Onne Gorter onne.gorter at nokia.com
Wed Jun 29 02:57:51 PDT 2005


Hi all,

I was trying out dbus on macosx. I have a set of applications that do  
work with a local bus by running eval `dbus-launch`.


Running a global client turned out to be a bit more difficult.

I created a messagebus user and group, and was running "dbus-daemon -- 
system". It works, except nobody can talk to the bus.

I guess because AUTH EXTERNAL doesn't seem to function. Now I am  
unsure how EXTERNAL is supposed to work, but maybe it is a linux  
specific thing? Or maybe you need a support library/infrastructure?

When commenting out the <auth> part, all methods are presented,  
including DBUS_COOKIE_SHA1. But when running as user messagebus,  
there is no way to write in my home directory. So this one doesn't  
work either.

I commented out <user> so it was running as root. Now it did write  
the cookie file, only the permissions where set as wrong:
-rw-------    1 root     ogorter   70B Jun 29 12:12  
org_freedesktop_general
this is probably a bug!

So repairing the permissions of that file did the trick.

So I am happy to report that dbus runs on macosx, though not  
perfectly ...

I am thinking about creating a launchd configuration for the system  
dbus and user dbus, that is like /etc/rc scripts for macosx. But I am  
learning as I go here. I will post my results to the mailinglist later.

-Onne

this is a ktrace/kdump (think strace) when EXTERNAL is failing:

hed036-185:~/.dbus-keyrings ogorter$ ktrace dbus-monitor --system
Failed to open connection to system message bus: No reply within  
specified time
hed036-185:~/.dbus-keyrings ogorter$ kdump
   1733 ktrace   RET   ktrace 0
   1733 ktrace   CALL  execve(0xbfffef4c,0xbffff50c,0xbffff518)
   1733 ktrace   NAMI  "/Users/ogorter/bin/dbus-monitor"
   1733 ktrace   RET   execve -1 errno 2 No such file or directory
   1733 ktrace   CALL  execve(0xbfffef4c,0xbffff50c,0xbffff518)
   1733 ktrace   NAMI  "/maemo/bin/dbus-monitor"
   1733 ktrace   NAMI  "/usr/lib/dyld"
   1733 dbus-monitor RET   execve 0

...

   1733 dbus-monitor CALL  socket(0x1,0x1,0)
   1733 dbus-monitor RET   socket 3
   1733 dbus-monitor CALL  connect(0x3,0xbffff0fc,0x6a)
   1733 dbus-monitor NAMI  "/maemo/var/run/dbus/system_bus_socket"
   1733 dbus-monitor RET   connect 0
   1733 dbus-monitor CALL  fcntl(0x3,0x3,0)
   1733 dbus-monitor RET   fcntl 2
   1733 dbus-monitor CALL  fcntl(0x3,0x4,0x6)
   1733 dbus-monitor RET   fcntl 0
   1733 dbus-monitor CALL  fcntl(0x3,0x1,0)
   1733 dbus-monitor RET   fcntl 0
   1733 dbus-monitor CALL  fcntl(0x3,0x2,0x1)
   1733 dbus-monitor RET   fcntl 0
   1733 dbus-monitor CALL  getuid
   1733 dbus-monitor RET   getuid 501/0x1f5
   1733 dbus-monitor CALL  sigaction(0xd,0xbffff118,0xbffff184)
   1733 dbus-monitor RET   sigaction 0
   1733 dbus-monitor CALL  poll(0xbffff110,0x1,0)
   1733 dbus-monitor RET   poll 1
   1733 dbus-monitor CALL  write(0x3,0xbfffef8c,0x1)
   1733 dbus-monitor GIO   fd 3 wrote 1 byte
        "\0"
   1733 dbus-monitor RET   write 1
   1733 dbus-monitor CALL  write(0x3,0x500990,0x16)
   1733 dbus-monitor GIO   fd 3 wrote 22 bytes
        "AUTH EXTERNAL 353031\r
        "
   1733 dbus-monitor RET   write 22/0x16
   1733 dbus-monitor CALL  poll(0xbffff110,0x1,0xffffffff)
   1733 dbus-monitor RET   poll 1
   1733 dbus-monitor CALL  read(0x3,0x1801000,0x800)
   1733 dbus-monitor GIO   fd 3 read 36 bytes
        "REJECTED EXTERNAL DBUS_COOKIE_SHA1\r
        "
   1733 dbus-monitor RET   read 36/0x24
   1733 dbus-monitor CALL  getuid
   1733 dbus-monitor RET   getuid 501/0x1f5
   1733 dbus-monitor CALL  poll(0xbffff110,0x1,0xffffffff)
   1733 dbus-monitor RET   poll 1
   1733 dbus-monitor CALL  write(0x3,0x500990,0x16)
   1733 dbus-monitor GIO   fd 3 wrote 22 bytes
        "AUTH EXTERNAL 353031\r
        "
   1733 dbus-monitor RET   write 22/0x16
   1733 dbus-monitor CALL  poll(0xbffff110,0x1,0xffffffff)
   1733 dbus-monitor RET   poll 1
   1733 dbus-monitor CALL  read(0x3,0x1801000,0x800)
   1733 dbus-monitor GIO   fd 3 read 36 bytes
        "REJECTED EXTERNAL DBUS_COOKIE_SHA1\r
        "
   1733 dbus-monitor RET   read 36/0x24
   1733 dbus-monitor CALL  getuid
   1733 dbus-monitor RET   getuid 501/0x1f5
   1733 dbus-monitor CALL  getlogin(0xa000c760,0xff)
   1733 dbus-monitor RET   getlogin 0
   1733 dbus-monitor CALL  getpid
   1733 dbus-monitor RET   getpid 1733/0x6c5
   1733 dbus-monitor CALL  poll(0xbffff110,0x1,0xffffffff)
   1733 dbus-monitor RET   poll 1
   1733 dbus-monitor CALL  write(0x3,0x5015f0,0x26)
   1733 dbus-monitor GIO   fd 3 wrote 38 bytes
        "AUTH DBUS_COOKIE_SHA1 6f676f72746572\r
        "
   1733 dbus-monitor RET   write 38/0x26
   1733 dbus-monitor CALL  poll(0xbffff110,0x1,0xffffffff)
   1733 dbus-monitor RET   poll 1
   1733 dbus-monitor CALL  read(0x3,0x1801000,0x800)
   1733 dbus-monitor GIO   fd 3 read 36 bytes
        "REJECTED EXTERNAL DBUS_COOKIE_SHA1\r
        "
   1733 dbus-monitor RET   read 36/0x24
   1733 dbus-monitor CALL  close(0x3)
   1733 dbus-monitor RET   close 0
   1733 dbus-monitor CALL  write(0x2,0xbfffeed0,0x50)
   1733 dbus-monitor GIO   fd 2 wrote 80 bytes
        "Failed to open connection to system message bus: No reply  
within speci\
         fied time
        "
   1733 dbus-monitor RET   write 80/0x50
   1733 dbus-monitor CALL  exit(0x1)


More information about the dbus mailing list