kugel- commented on this pull request.


> @@ -439,20 +441,35 @@ static gint socket_fd_open_unix(const gchar *path)
                return -1;
        }
 
-       /* fix for #1888561:
-        * in case the configuration directory is located on a network file 
system or any other
-        * file system which doesn't support sockets, we just link the socket 
there and create the
-        * real socket in the system's tmp directory assuming it supports 
sockets */
-       real_path = g_strdup_printf("%s%cgeany_socket.%08x",
-               g_get_tmp_dir(), G_DIR_SEPARATOR, g_random_int());
+       /* Try to place the socket in XDG_RUNTIME_DIR, according to XDG Base
+        * Directory Specification, see
+        * https://specifications.freedesktop.org/basedir-spec/latest */
+       real_dir = g_build_filename(g_get_user_runtime_dir(), "geany", NULL);
+       if (g_mkdir_with_parents(real_dir, 0755) == 0)

I use `_with_parents()` in case the geany directory already exists. I could 
also use mkdir() and handle EEXIST but this seemed more convenient. 

For the runtime directory, I assume it already exists, since it's provided by 
the spec. If that's not the case I think we cuoldn't create it since users 
generally don't have sufficient permissions for /var/run/user.

I also considered that the 0700 requirement applies to the $XDG_RUNTIME_DIR 
itself. A quick survey on my system shows that the subdirectories are 
inconsistent, but the systemd subdirectory (and systemd manages 
$XDG_RUNTIME_DIR) has 0755. I guess it doesn't matter much. Can change to 0700 
if you want.

```
srw-rw-rw- 1 kugel kugel   0 16. Jul 06:57 bus
drwx------ 2 kugel kugel  60 17. Jul 16:14 dconf
drwxr-xr-x 2 kugel kugel  40 18. Jul 07:13 geany
drwx------ 2 kugel kugel 140 16. Jul 06:57 gnupg
srw------- 1 kugel kugel   0 16. Jul 06:57 kdeinit5__0
srwxr-xr-x 1 kugel kugel   0 16. Jul 06:57 klauncherdKXvtl.1.slave-socket
-rw-r--r-- 1 kugel kugel  74 16. Jul 06:57 KSMserver__0
srwxr-xr-x 1 kugel kugel   0 16. Jul 06:57 kwallet5.socket
drwxr-xr-x 2 kugel kugel  60 16. Jul 06:57 Nextcloud
drwxr-xr-x 2 kugel kugel  60 16. Jul 06:57 p11-kit
srw-rw-rw- 1 kugel kugel   0 16. Jul 06:57 pipewire-0
drwx------ 2 kugel kugel 100 16. Jul 06:57 pulse
drwxr-xr-x 3 kugel kugel 100 16. Jul 06:57 systemd
drwx------ 2 kugel kugel  40 18. Jul 21:56 xpra
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/2222#discussion_r305113299

Reply via email to