nit
nit copied to clipboard
macosx: libxdg-basedir segmentation faults
I get the following when I launch bin/calculator (on MacOS 10.10.4):
Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
Caught signal : Segmentation fault: 11
-------------------------------------------------
-- Stack Trace ------------------------------
-------------------------------------------------
` sig_handler
` _sigtramp
` xdgConfigHome
` xdg_basedir___XdgBasedir_config_home___impl
` xdg_basedir#XdgBasedir#config_home (../../lib/xdg_basedir/xdg_basedir.nit:56)
` linux::data_store#LinuxStore#db (../../lib/linux/data_store.nit:40)
` linux::data_store#LinuxStore#app::data_store::DataStore::[] (../../lib/linux/data_store.nit:66)
` calculator#CalculatorWindow#app::app_base::AppComponent::on_restore_state (src/calculator.nit:103)
` linux::ui#app::App#run (../../lib/linux/ui.nit:26)
` main
-------------------------------------------------
Segmentation fault: 11
Note that after having applied the following workaround, the calculator was fully functional
diff --git a/lib/xdg_basedir/xdg_basedir.nit b/lib/xdg_basedir/xdg_basedir.nit
index 6c53124..b1c2777 100644
--- a/lib/xdg_basedir/xdg_basedir.nit
+++ b/lib/xdg_basedir/xdg_basedir.nit
@@ -55,7 +55,7 @@ extern class XdgBasedir `{ xdgHandle* `}
# Base directory for user specific configuration files.
fun config_home: String import NativeString.to_s `{
- return NativeString_to_s((char*)xdgConfigHome(self));
+ return NativeString_to_s(".config");
`}
# Base directory for user specific non-essential data files.
After investigation, the dbus-session error message is a red herring and unrelated to the crash. By the way it can be removed by following the instructions given by dbus/ports
$ port note dbus
dbus has the following notes:
############################################################################
# Startup items have been generated that will aid in
# starting dbus with launchd. They are disabled
# by default. Execute the following commands to start them,
# and to cause them to launch at startup:
#
# sudo launchctl load -w /Library/LaunchDaemons/org.freedesktop.dbus-system.plist
# launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist
############################################################################
The culprit here seems to be the function xdgConfigHome of libxdg-basedir that just segfault. Need more investigation on why.