Opened 16 years ago

Closed 15 years ago

#16833 closed defect (fixed)

dbus autolaunch fails because of '/' characters in $DISPLAY

Reported by: mp@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 1.6.0
Keywords: Cc: nox@…, ryanjohns@…, mf2k (Frank Schima), pgijnxn02@…, ctempleton3@…
Port: dbus

Description

dbus autolaunch fails on OS X 10.5 Leopard because the DISPLAY environment variable contains '/' characters. (It may also fail on 10.4 but I haven't tested it.)

dbus-launch uses the DISPLAY env var to form the filename for the session file, and then opens/creates that file with a call to fopen(). But because the filename now contains '/' characters, fopen() fails as it tries to create directories.

I've made a patch for dbus-launch-x11.c which changes all '/' characters to '_' characters in the filename. This patch should be safe for 10.4 as well. I've also made a Portfile patch.

I've filed the bug and patch upstream at https://bugs.freedesktop.org/show_bug.cgi?id=18013 but thought that we should include it in macports until it gets applied upstream.

This bug is related to one of the problems with gnucash that is being reported in bug #16755

Attachments (3)

patch-dbus-launch-x11.c.diff (288 bytes) - added by mp@… 16 years ago.
Patches dbus-launch-x11.c to replace '/' characters with '_' in the session filename
dbus_Portfile.diff (666 bytes) - added by mp@… 16 years ago.
patches the dbus Portfile to apply the patch-dbus-launch-x11.c.diff patchfile.
Portfile.patch (713 bytes) - added by mtalexander (Mike Alexander) 16 years ago.
Patch to set DBUS_TEST_SOCKET_DIR correctly and add a +verbose variant

Download all attachments as: .zip

Change History (25)

Changed 16 years ago by mp@…

Patches dbus-launch-x11.c to replace '/' characters with '_' in the session filename

Changed 16 years ago by mp@…

Attachment: dbus_Portfile.diff added

patches the dbus Portfile to apply the patch-dbus-launch-x11.c.diff patchfile.

comment:1 Changed 16 years ago by mf2k (Frank Schima)

Owner: changed from macports-tickets@… to macsforever2000@…
Status: newassigned

comment:2 Changed 16 years ago by mf2k (Frank Schima)

Resolution: fixed
Status: assignedclosed

Committed revision r40785. Thanks, this allows gnucash to launch properly for me now!

comment:3 Changed 16 years ago by ryanjohns@…

This does not fix gnucash's launch issues for me. I installed dbus @1.2.4_2, rebooted to ensure the new version was running, and when I run gnucash I get the same error box from gnucash with the following message in the terminal...

(gnucash:426): qof-CRITICAL : qof_object_shutdown: assertion `object_is_initialized == TRUE' failed

I was previously using dbus @1.2.4_1 with "eval /opt/local/bin/dbus-launch --sh-syntax" added to the gnucash launch script and it was working fine. The new version of dbus (1.2.4_2) does not work for me with or without the eval line in the gnucash launch script. I am on 10.5.5 intel with the latest version of macports. Please let me know if you need any more information or have any suggestions.

comment:4 Changed 16 years ago by ryanjohns@…

Cc: ryanjohns@… added

Cc Me!

comment:5 in reply to:  3 ; Changed 16 years ago by mf2k (Frank Schima)

Replying to ryanjohns@…:

This does not fix gnucash's launch issues for me.

What version of gconf and gnucash do you have installed?

comment:6 in reply to:  5 Changed 16 years ago by ryanjohns@…

Replying to macsforever2000@…:

What version of gconf and gnucash do you have installed?

The following ports are currently installed:

gnucash @2.2.7_2+without_hbci+without_ofx+without_quotes (active) gconf @2.24.0_0 (active)

comment:7 Changed 16 years ago by mf2k (Frank Schima)

I have the same versions and everything works fine here. The only difference between our setups is that I have straight gnucash installed without the variants you have listed. Maybe you can try installing gnucash that way?

comment:8 Changed 16 years ago by ryanjohns@…

I'll look into it more when I have some time but it works fine with the dbus-launch workaround for now. I can't remember exactly what I added to the gnucash launch script so could you please post the top 10 or so lines from that script so I can compare? The script is in /opt/local/bin/gnucash assuming macports was installed to the default location. Thanks

comment:9 Changed 16 years ago by mf2k (Frank Schima)

Here's my untouched gnucash script:

#!/bin/sh

PATH="/opt/local/bin:${PATH}"
export PATH

GUILE_WARN_DEPRECATED="no"
export GUILE_WARN_DEPRECATED

GNC_MODULE_PATH="/opt/local/lib/gnucash:${GNC_MODULE_PATH}"

EXTRA_PATH="${EXTRA_PATH}:/opt/local/share/gnucash/guile-modules"
EXTRA_PATH="${EXTRA_PATH}:/opt/local/share/gnucash/scm"
GUILE_LOAD_PATH="${EXTRA_PATH}:${GUILE_LOAD_PATH}"

EXTRA_LIBS="${GNC_MODULE_PATH}"
EXTRA_LIBS="${EXTRA_LIBS}:/opt/local/lib"
EXTRA_LIBS="${EXTRA_LIBS}:/opt/local/lib/gnucash"

LD_LIBRARY_PATH="${EXTRA_LIBS}:${LD_LIBRARY_PATH}"
DYLD_LIBRARY_PATH="/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/Image
IO.framework/Versions/A/Resources:${EXTRA_LIBS}:${DYLD_LIBRARY_PATH}"

export GNC_MODULE_PATH
export GUILE_LOAD_PATH
export LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH

exec gnucash-bin "$@"

If you still have issues with gnucash, you should open a new ticket because this ticket really is aimed at fixing dbus. Thanks!

comment:10 Changed 16 years ago by ryanjohns@…

This may still be related to dbus. I activated dbus 1.2.4_2 and reverted the gnucash launch script back to the vanilla version. If I run 'gnucash' from the command line I get the error dialog from gnucash about not being able to find default values. If I try 'dbus-launch gnucash' *or* 'dbus-launch --sh-syntax' I get the following error...

Failed to start message bus: In D-Bus address, character '+' should have been escaped EOF in dbus-launch reading address from bus daemon

... which leads me to believe that there is in fact something wrong with dbus since I get the same error with no mention of gnucash. My DISPLAY env variable is '/tmp/launch-0ukbnG/:0'. Thanks for your continued help.

comment:11 Changed 16 years ago by ryanjohns@…

I have it working now. I just uninstalled all versions of dbus then reinstalled dbus 1.2.4_2 and it works now. So I don't really know what actually happened but now I don't care. Thanks for your help macsforever2000.

comment:12 Changed 16 years ago by mf2k (Frank Schima)

Glad you got it working!

Changed 16 years ago by mtalexander (Mike Alexander)

Attachment: Portfile.patch added

Patch to set DBUS_TEST_SOCKET_DIR correctly and add a +verbose variant

comment:13 in reply to:  10 Changed 16 years ago by mtalexander (Mike Alexander)

This may still be related to dbus. I activated dbus 1.2.4_2 and reverted the gnucash launch script back to the vanilla version. If I run 'gnucash' from the command line I get the error dialog from gnucash about not being able to find default values. If I try 'dbus-launch gnucash' *or* 'dbus-launch --sh-syntax' I get the following error...

Failed to start message bus: In D-Bus address, character '+' should have been escaped EOF in dbus-launch reading address from bus daemon

This message occurs if you build dbus as yourself instead of using sudo (you must use sudo to install it, but not necessarily to build it depending on how you've built macports itself). The config file for dbus gets the value for DBUS_TEST_SOCKET_DIR from TMPDIR if it is defined. On Leopard TMPDIR has a value like

/var/folders/XO/XOAhu-l42RWX5U+kNPkZqU+++TI/-Tmp-/

This doesn't work because dbus doesn't like the "+" characters in it. Besides it really should be using a global temp directory for its sockets rather than your private one. This is not a problem if you use sudo to build dbus since sudo doesn't pass TMPDIR to the command it executes. I've fixed this and attached a Portfile with a patch to use /tmp for its sockets. This patch also adds a +verbose variant that enables more debugging output (under control of the DBUS_VERBOSE environment variable).

comment:14 Changed 16 years ago by mf2k (Frank Schima)

Resolution: fixed
Status: closedreopened

comment:15 Changed 16 years ago by mf2k (Frank Schima)

Owner: changed from macsforever2000@… to macports-tickets@…
Status: reopenednew

I'll try to look at this soon. But in the meantime, I'm un-assigning it from myself in case someone else can look at this.

comment:16 Changed 16 years ago by mf2k (Frank Schima)

Cc: macsforever2000@… added

Cc Me!

comment:17 Changed 16 years ago by jonas.baehr@…

Please try the dbus port in #17950, it uses launchd the storing the session bus address instead of X11.

comment:18 Changed 16 years ago by illogic-al@…

The port has been committed. Please update dbus and report any prolems.

comment:19 Changed 16 years ago by pgijnxn02@…

Cc: pgijnxn02@… added

Cc Me!

comment:20 Changed 16 years ago by (none)

Milestone: Port Bugs

Milestone Port Bugs deleted

comment:21 Changed 15 years ago by ctempleton3@…

Cc: ctempleton3@… added

Cc Me!

comment:22 Changed 15 years ago by nox@…

Resolution: fixed
Status: newclosed

fixed 5 months ago

Note: See TracTickets for help on using tickets.