Subject: Re: bug#44131: 28.0.50; emacsclient Invalid socket owner error

From: Andrew Eggenberger <[email-masked]>
Date: Sun, 1 Nov 2020 19:24:42 -0600

Hi,

The problem seems to stem from the way the hurd treats fstat calls on local
socket
file descriptors. They all have the uid of 0 (root), while emacsclient can
be run by
other users. After trying to teach the hurd's local socket server to use
the uid of
the user who requested the socket and failing, I created the naive patch
below that
fixes the problem.

Please let me know if there's a better solution. I git blamed the changes
that led to this
issue and I don't understand the race condition the uid comparison is
supposed prevent.

Andrew Eggenberger

diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 871fa7a8d3..6059993ff6 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1480,8 +1480,13 @@ set_local_socket (char const *server_name)
        sock_status = errno;
       else if (connect_stat.st_uid == uid)
        return s;
+#ifdef __GNU__
+      else
+       return s;
+#else
       else
        sock_status = -1;
+#endif

       CLOSE_SOCKET (s);
     }