From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#44131: 28.0.50; emacsclient Invalid socket owner error Date: Sat, 07 Nov 2020 10:47:35 +0200 Message-ID: <83pn4p7dug.fsf@gnu.org> References: <871rhqsoln.fsf@debian.i-did-not-set--mail-host-address--so-tickle-me> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20213"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 44131@debbugs.gnu.org, akrl@sdf.org To: Andrew Eggenberger , Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 07 09:48:09 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kbJtJ-00059V-Qs for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 07 Nov 2020 09:48:09 +0100 Original-Received: from localhost ([::1]:52398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kbJtI-0003VY-QF for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 07 Nov 2020 03:48:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kbJtC-0003VJ-0h for bug-gnu-emacs@gnu.org; Sat, 07 Nov 2020 03:48:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46374) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kbJtB-0002B3-Nw for bug-gnu-emacs@gnu.org; Sat, 07 Nov 2020 03:48:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kbJtB-0005Cy-L8 for bug-gnu-emacs@gnu.org; Sat, 07 Nov 2020 03:48:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Nov 2020 08:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44131 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 44131-submit@debbugs.gnu.org id=B44131.160473886419997 (code B ref 44131); Sat, 07 Nov 2020 08:48:01 +0000 Original-Received: (at 44131) by debbugs.gnu.org; 7 Nov 2020 08:47:44 +0000 Original-Received: from localhost ([127.0.0.1]:57920 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kbJst-0005CT-Na for submit@debbugs.gnu.org; Sat, 07 Nov 2020 03:47:44 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44546) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kbJss-0005CG-2H for 44131@debbugs.gnu.org; Sat, 07 Nov 2020 03:47:42 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:55281) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kbJsk-0001yg-Vm; Sat, 07 Nov 2020 03:47:34 -0500 Original-Received: from [176.228.60.248] (port=3004 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kbJsk-0007UV-BG; Sat, 07 Nov 2020 03:47:34 -0500 In-Reply-To: (message from Andrew Eggenberger on Sun, 1 Nov 2020 19:24:42 -0600) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:192819 Archived-At: > From: Andrew Eggenberger > Date: Sun, 1 Nov 2020 19:24:42 -0600 > Cc: 44131@debbugs.gnu.org > > 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); > } Paul, any better ideas? Or should I push this fix? Thanks.