GNU bug report logs - #44131
28.0.50; emacsclient Invalid socket owner error

Previous Next

Package: emacs;

Reported by: Andrew Eggenberger <andrew.eggenberger <at> gmail.com>

Date: Thu, 22 Oct 2020 02:33:01 UTC

Severity: normal

Tags: moreinfo

Found in version 28.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 44131 in the body.
You can then email your comments to 44131 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#44131; Package emacs. (Thu, 22 Oct 2020 02:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andrew Eggenberger <andrew.eggenberger <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 22 Oct 2020 02:33:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andrew Eggenberger <andrew.eggenberger <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; emacsclient Invalid socket owner error in gccemacs
Date: Thu, 22 Oct 2020 02:32:04 -0500
The emacsclient binary produced by the native-comp branch cannot connect
to the server. When a connection is attempted, the error message
"emacsclient: Invalid socket owner" is displayed. I have 27.1 without
native-comp installed, and that emacsclient can connect to the
native-comp server without issue.

The error is the result of a failed uid comparison in
lib-src/emacsclient.c. It appears that the uid produced by geteuid()
isn't matching the uid for the server socket.

I first noticed the issue while trying to do a magit commit. But the
same error happens when trying to run emacsclient from the command line.


In GNU Emacs 28.0.50 (build 1, i686-unknown-gnu0.9, GTK+ Version 3.24.20, cairo version 1.16.0)
 of 2020-10-21 built on debian
Repository revision: 3be93390fb6680d1e0c3256af72c86635a9eb327
Repository branch: feature/native-comp
System Description: Debian GNU/Hurd bullseye/sid

Configured using:
 'configure --with-nativecomp --prefix=/home/demo/.local/'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO DBUS GSETTINGS GLIB NOTIFY GFILENOTIFY
ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES NATIVE_COMP THREADS
LIBSYSTEMD PDUMPER LCMS2

Important settings:
  locale-coding-system: nil

Major mode: Magit Process

Minor modes in effect:
  global-undo-tree-mode: t
  undo-tree-mode: t
  global-magit-file-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  which-key-mode: t
  projectile-mode: t
  global-flycheck-mode: t
  global-company-mode: t
  company-mode: t
  helm-mode: t
  helm-ff-cache-mode: t
  shell-dirtrack-mode: t
  helm--remap-mouse-mode: t
  async-bytecomp-package-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug sendmail helm-command helm-elisp
helm-eval edebug backtrace helm-info magit-extras mule-util face-remap
vc-git cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align
cc-engine cc-vars cc-defs winner image-file image-converter
helm-external helm-net xml url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util mailcap ffap
term/xterm xterm jka-compr undo-tree magit-submodule magit-obsolete
magit-blame magit-stash magit-reflog magit-bisect magit-push magit-pull
magit-fetch magit-clone magit-remote magit-commit magit-sequence
magit-notes magit-worktree magit-tag magit-merge magit-branch
magit-reset magit-files magit-refs magit-status magit magit-repos
magit-apply magit-wip magit-log which-func imenu magit-diff smerge-mode
diff diff-mode magit-core magit-autorevert autorevert filenotify
magit-margin magit-transient magit-process magit-mode git-commit
transient magit-git magit-section magit-utils crm log-edit message rmc
puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg epg-config
gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev
mail-utils gmm-utils mailheader pcvs-util add-log with-editor server
which-key comp warnings projectile grep compile text-property-search
ibuf-ext ibuffer ibuffer-loaddefs thingatpt flycheck find-func rx dash
company-oddmuse company-keywords company-etags etags fileloop generator
xref project company-gtags company-dabbrev-code company-dabbrev
company-files company-clang company-capf company-cmake company-semantic
company-template company-bbdb company paredit helm-mode helm-files tramp
tramp-loaddefs trampver tramp-integration files-x tramp-compat shell
pcomplete comint ansi-color ring parse-time iso8601 time-date ls-lisp
helm-buffers helm-occur helm-tags helm-locate helm-grep helm-regexp
format-spec helm-utils helm-help helm-types helm-config helm easy-mmode
async-bytecomp advice helm-global-bindings helm-easymenu edmacro kmacro
helm-source eieio-compat helm-multi-match helm-lib async cl-extra
help-mode use-package-ensure use-package-core finder-inf disp-table info
package easymenu browse-url url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core term/tty-colors frame minibuffer cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face pcase macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
gfilenotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty
make-network-process nativecomp emacs)

Memory information:
((conses 8 312548 30532)
 (symbols 24 26544 10)
 (strings 16 87420 8718)
 (string-bytes 1 3294833)
 (vectors 8 44603)
 (vector-slots 4 791812 51818)
 (floats 8 144 434)
 (intervals 28 736 356)
 (buffers 564 20))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44131; Package emacs. (Thu, 22 Oct 2020 12:55:02 GMT) Full text and rfc822 format available.

Message #8 received at 44131 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Andrew Eggenberger <andrew.eggenberger <at> gmail.com>
Cc: 44131 <at> debbugs.gnu.org
Subject: Re: bug#44131: 28.0.50; emacsclient Invalid socket owner error in
 gccemacs
Date: Thu, 22 Oct 2020 14:54:33 +0200
Andrew Eggenberger <andrew.eggenberger <at> gmail.com> writes:

> The emacsclient binary produced by the native-comp branch cannot connect
> to the server. When a connection is attempted, the error message
> "emacsclient: Invalid socket owner" is displayed. I have 27.1 without
> native-comp installed, and that emacsclient can connect to the
> native-comp server without issue.

I tried this with the current native-comp branch:

$ ./src/emacs -Q
M-x server-start
$ ./lib-src/emacsclient -t

and everything worked as it should, so I'm unable to reproduce this bug.

Do you have a recipe for reproducing this?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 22 Oct 2020 12:55:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44131; Package emacs. (Thu, 22 Oct 2020 20:42:02 GMT) Full text and rfc822 format available.

Message #13 received at 44131 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <akrl <at> sdf.org>
To: Andrew Eggenberger <andrew.eggenberger <at> gmail.com>
Cc: 44131 <at> debbugs.gnu.org
Subject: Re: bug#44131: 28.0.50; emacsclient Invalid socket owner error in
 gccemacs
Date: Thu, 22 Oct 2020 20:41:19 +0000
Andrew Eggenberger <andrew.eggenberger <at> gmail.com> writes:

> The emacsclient binary produced by the native-comp branch cannot connect
> to the server. When a connection is attempted, the error message
> "emacsclient: Invalid socket owner" is displayed. I have 27.1 without
> native-comp installed, and that emacsclient can connect to the
> native-comp server without issue.
>
> The error is the result of a failed uid comparison in
> lib-src/emacsclient.c. It appears that the uid produced by geteuid()
> isn't matching the uid for the server socket.
>
> I first noticed the issue while trying to do a magit commit. But the
> same error happens when trying to run emacsclient from the command line.

Hi Andrew,

thanks for reporting.  I believe this should not be related to the
native compilaiton (BTW for me it works, I always use emacsclient).

Could you try if you get the same error building master?

Thanks!

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44131; Package emacs. (Thu, 22 Oct 2020 23:46:01 GMT) Full text and rfc822 format available.

Message #16 received at 44131 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Eggenberger <andrew.eggenberger <at> gmail.com>
To: Andrea Corallo <akrl <at> sdf.org>
Cc: 44131 <at> debbugs.gnu.org
Subject: Re: bug#44131: 28.0.50;
 emacsclient Invalid socket owner error in gccemacs
Date: Thu, 22 Oct 2020 18:45:15 -0500
[Message part 1 (text/plain, inline)]
Thanks all. It looks like the socket verification logic changes in Commit
3e5d7755454bea9b6ffd232b1d115c629cdb193d. I realized my other version where
it works was 26.3, before that change. I think my problem might be
hurd-specific, but I'll have to do some more digging.

Andrew
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44131; Package emacs. (Thu, 22 Oct 2020 23:47:02 GMT) Full text and rfc822 format available.

Message #19 received at 44131 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Eggenberger <andrew.eggenberger <at> gmail.com>
To: Andrea Corallo <akrl <at> sdf.org>
Cc: 44131 <at> debbugs.gnu.org
Subject: Re: bug#44131: 28.0.50;
 emacsclient Invalid socket owner error in gccemacs
Date: Thu, 22 Oct 2020 18:46:20 -0500
[Message part 1 (text/plain, inline)]
Sorry, and to answer your question: the problem was still there when I
compiled 28 master.

>
[Message part 2 (text/html, inline)]

Changed bug title to '28.0.50; emacsclient Invalid socket owner error' from '28.0.50; emacsclient Invalid socket owner error in gccemacs' Request was from Andrea Corallo <akrl <at> sdf.org> to control <at> debbugs.gnu.org. (Fri, 23 Oct 2020 06:41:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44131; Package emacs. (Fri, 23 Oct 2020 06:49:01 GMT) Full text and rfc822 format available.

Message #24 received at 44131 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <akrl <at> sdf.org>
To: Andrew Eggenberger <andrew.eggenberger <at> gmail.com>
Cc: 44131 <at> debbugs.gnu.org
Subject: Re: bug#44131: 28.0.50; emacsclient Invalid socket owner error
Date: Fri, 23 Oct 2020 06:48:03 +0000
Andrew Eggenberger <andrew.eggenberger <at> gmail.com> writes:

> Sorry, and to answer your question: the problem was still there when I compiled 28 master.

Hi Andrew,

thanks for checking, I've re-titled to bug.  Let us know if you discover
it's hurd specific we can narrow it down further.

Thanks

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44131; Package emacs. (Mon, 02 Nov 2020 01:25:01 GMT) Full text and rfc822 format available.

Message #27 received at 44131 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Eggenberger <andrew.eggenberger <at> gmail.com>
To: Andrea Corallo <akrl <at> sdf.org>
Cc: 44131 <at> debbugs.gnu.org
Subject: Re: bug#44131: 28.0.50; emacsclient Invalid socket owner error
Date: Sun, 1 Nov 2020 19:24:42 -0600
[Message part 1 (text/plain, inline)]
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);
     }
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44131; Package emacs. (Sat, 07 Nov 2020 08:48:01 GMT) Full text and rfc822 format available.

Message #30 received at 44131 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andrew Eggenberger <andrew.eggenberger <at> gmail.com>,
 Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 44131 <at> debbugs.gnu.org, akrl <at> sdf.org
Subject: Re: bug#44131: 28.0.50; emacsclient Invalid socket owner error
Date: Sat, 07 Nov 2020 10:47:35 +0200
> From: Andrew Eggenberger <andrew.eggenberger <at> gmail.com>
> Date: Sun, 1 Nov 2020 19:24:42 -0600
> Cc: 44131 <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44131; Package emacs. (Wed, 11 Nov 2020 03:32:02 GMT) Full text and rfc822 format available.

Message #33 received at 44131 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Eggenberger <andrew.eggenberger <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Paul Eggert <eggert <at> cs.ucla.edu>, 44131 <at> debbugs.gnu.org,
 Andrea Corallo <akrl <at> sdf.org>
Subject: Re: bug#44131: 28.0.50; emacsclient Invalid socket owner error
Date: Tue, 10 Nov 2020 21:30:56 -0600
[Message part 1 (text/plain, inline)]
Hi Eli,

I've just submitted a patch to the hurd mailing list that resolves the
issue without any
changes to emacsclient. I think we can close this issue.

Thanks
Andrew
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44131; Package emacs. (Wed, 11 Nov 2020 09:45:02 GMT) Full text and rfc822 format available.

Message #36 received at 44131 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Andrew Eggenberger <andrew.eggenberger <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Paul Eggert <eggert <at> cs.ucla.edu>,
 44131 <at> debbugs.gnu.org, Andrea Corallo <akrl <at> sdf.org>
Subject: Re: bug#44131: 28.0.50; emacsclient Invalid socket owner error
Date: Wed, 11 Nov 2020 10:44:22 +0100
Andrew Eggenberger <andrew.eggenberger <at> gmail.com> writes:

> I've just submitted a patch to the hurd mailing list that resolves the
> issue without any changes to emacsclient. I think we can close this
> issue.

OK; done.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 44131 <at> debbugs.gnu.org and Andrew Eggenberger <andrew.eggenberger <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 11 Nov 2020 09:45:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 09 Dec 2020 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 111 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.