[Users] Revisiting the socket_dir $TMPDIR issue

Michael Schwendt bugreporter at abwesend.de
Tue Nov 4 19:35:39 CET 2014


Hello everyone, especially the developers!

This is about the issue with Claws Mail, Firefox and mailto handlers,
where Claws Mail is started more than once because of a different tmp dir
than $TMPDIR due to either Firefox altering an unset $TMPDIR or other
programs deleting a set $TMPDIR (e.g. gnome-terminal does that). It has
been discussed on the list before as well as in various other places.

Trying once more to figure out how it could be fixed, it has been suggested
that following the XDG basedir spec would be a solution:

  https://fedorahosted.org/fesco/ticket/1365#comment:11

And indeed, using glib's g_get_user_runtime_dir() instead of
g_get_tmp_dir() even works for the gnome-terminal's mailto handler issue.

  $ echo $XDG_RUNTIME_DIR
  /run/user/1000

If $XDG_RUNTIME_DIR is not set, g_get_user_runtime_dir() falls back
to $XDG_CACHE_HOME:

  $ unset XDG_RUNTIME_DIR
  $ echo $XDG_CACHE_HOME

  $ xdg-user-dir RUNTIME
  /home/ms21b

Would that be an option (if not putting the file below $HOME/.claws-mail instead)?


diff -Nurb --strip-trailing-cr claws-mail-3.11.1-orig/src/main.c claws-mail-3.11.1/src/main.c
--- claws-mail-3.11.1-orig/src/main.c	2014-10-27 19:58:13.000000000 +0100
+++ claws-mail-3.11.1/src/main.c	2014-11-04 19:13:50.172033231 +0100
@@ -2144,7 +2144,7 @@
 		gint stat_ok;
 
 		socket_dir = g_strdup_printf("%s%cclaws-mail-%d",
-					   g_get_tmp_dir(), G_DIR_SEPARATOR,
+					   g_get_user_runtime_dir(), G_DIR_SEPARATOR,
 #if HAVE_GETUID
 					   getuid());
 #else



More information about the Users mailing list