unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20675: 24.3; emacsclient cannot talk to emacs
@ 2015-05-27 18:09 Bruce Korb
  2019-09-29 23:46 ` Stefan Kangas
  0 siblings, 1 reply; 10+ messages in thread
From: Bruce Korb @ 2015-05-27 18:09 UTC (permalink / raw)
  To: 20675

From: Bruce Korb <bruce.korb@gmail.com>
To: bug-gnu-emacs@gnu.org
Subject: 24.3; emacsclient cannot talk to emacs
--text follows this line--
This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgment at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from `emacs -Q':

I have no idea what may have triggered the bug.
I am using emacsclient and emacs just fine for quite a while,
then all of a sudden:

> $ emacsclient cscope.files
> emacsclient: can't find socket; have you started the server?
> To start the server in Emacs, type "M-x server-start".
> emacsclient: No socket or alternate editor.  Please use:
>
>         --socket-name
>         --server-file      (or environment variable EMACS_SERVER_FILE)
>         --alternate-editor (or environment variable ALTERNATE_EDITOR)

so I start up another xterm running bash and everything is fine.
For a while.  Then the same thing happens.  I do *NOT* have to restart
emacs or even the server code.  I have to start another xterm.
(Re-exec-ing bash does no good.)  So, clearly, something is scrogged
in the xterm so that it cannot talk to...........

AH HA!!

The problem is that I need to redirect TMPDIR to different places for
different tasks.  So that explainer above might get expanded to include
mention of the fact that this directory:  ${TMPDIR}/emacs$(id -u)
is used for communication.  I'd have found the problem long ago.

So please consider this an RFE to the above "can't find socket" message.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#20675: 24.3; emacsclient cannot talk to emacs
  2015-05-27 18:09 bug#20675: 24.3; emacsclient cannot talk to emacs Bruce Korb
@ 2019-09-29 23:46 ` Stefan Kangas
  2019-10-01 17:31   ` Bruce Korb
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Kangas @ 2019-09-29 23:46 UTC (permalink / raw)
  To: Bruce Korb; +Cc: 20675

Bruce Korb <bruce.korb@gmail.com> writes:

> I have no idea what may have triggered the bug.
> I am using emacsclient and emacs just fine for quite a while,
> then all of a sudden:
>
>> $ emacsclient cscope.files
>> emacsclient: can't find socket; have you started the server?
>> To start the server in Emacs, type "M-x server-start".
>> emacsclient: No socket or alternate editor.  Please use:
>>
>>         --socket-name
>>         --server-file      (or environment variable EMACS_SERVER_FILE)
>>         --alternate-editor (or environment variable ALTERNATE_EDITOR)
>
> so I start up another xterm running bash and everything is fine.
> For a while.  Then the same thing happens.  I do *NOT* have to restart
> emacs or even the server code.  I have to start another xterm.
> (Re-exec-ing bash does no good.)  So, clearly, something is scrogged
> in the xterm so that it cannot talk to...........
>
> AH HA!!
>
> The problem is that I need to redirect TMPDIR to different places for
> different tasks.  So that explainer above might get expanded to include
> mention of the fact that this directory:  ${TMPDIR}/emacs$(id -u)
> is used for communication.  I'd have found the problem long ago.
>
> So please consider this an RFE to the above "can't find socket" message.

Are you saying that you are trying to use emacsclient with a different
$TMPDIR than the one you used for the emacs server?

Best regards,
Stefan Kagas





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#20675: 24.3; emacsclient cannot talk to emacs
  2019-09-29 23:46 ` Stefan Kangas
@ 2019-10-01 17:31   ` Bruce Korb
  2019-10-01 18:05     ` Stefan Kangas
  0 siblings, 1 reply; 10+ messages in thread
From: Bruce Korb @ 2019-10-01 17:31 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 20675

On Sun, Sep 29, 2019 at 4:46 PM Stefan Kangas <stefan@marxist.se> wrote:
> > The problem is that I need to redirect TMPDIR to different places for
> > different tasks.  So that explainer above might get expanded to include
> > mention of the fact that this directory:  ${TMPDIR}/emacs$(id -u)
> > is used for communication.  I'd have found the problem long ago.
> >
> > So please consider this an RFE to the above "can't find socket" message.
>
> Are you saying that you are trying to use emacsclient with a different
> $TMPDIR than the one you used for the emacs server?

What I am attempting to do is to have multiple (two) cscope-s running
each talking to a different server. The real issue being that I needed
emacs windows tied to a specific invocation of cscope. It seemed the
best way to do that was to have multiple servers running since "last
active emacs window" is inadequate. Anyway, for me, I retired 6 months
after posting this and doubt I'll ever want to run multiple cscopes in
parallel ever again. :)





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#20675: 24.3; emacsclient cannot talk to emacs
  2019-10-01 17:31   ` Bruce Korb
@ 2019-10-01 18:05     ` Stefan Kangas
  2019-10-01 18:39       ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Kangas @ 2019-10-01 18:05 UTC (permalink / raw)
  To: Bruce Korb; +Cc: 20675

Bruce Korb <bruce.korb@gmail.com> writes:

> > > The problem is that I need to redirect TMPDIR to different places for
> > > different tasks.  So that explainer above might get expanded to include
> > > mention of the fact that this directory:  ${TMPDIR}/emacs$(id -u)
> > > is used for communication.  I'd have found the problem long ago.
> > >
> > > So please consider this an RFE to the above "can't find socket" message.
> >
> > Are you saying that you are trying to use emacsclient with a different
> > $TMPDIR than the one you used for the emacs server?
>
> What I am attempting to do is to have multiple (two) cscope-s running
> each talking to a different server. The real issue being that I needed
> emacs windows tied to a specific invocation of cscope. It seemed the
> best way to do that was to have multiple servers running since "last
> active emacs window" is inadequate. Anyway, for me, I retired 6 months
> after posting this and doubt I'll ever want to run multiple cscopes in
> parallel ever again. :)

Thanks for reporting back, and I hope you're enjoying your retirement.

If I understand correctly, the problem is that there is a mismatch
between the $TMPDIR used on the emacs server and on the emacs client.

I think that the answer in this case should be: don't change $TMPDIR
unless you have to, and if you do, please be careful with how you do
it.  In other words, I have a hard time seeing how we could do better
here.

(I also note that we recently started preferring $XDG_RUNTIME_DIR if
that's set.)

But perhaps we could do something about the documentation.  I see that
server-socket-dir is documented in the Emacs FAQ, but not at all in
the manual.  Is that really right?  I would have expected it to be the
other way around: the FAQ is just the quick-start version, and one
would have to read the manual for all the details.

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#20675: 24.3; emacsclient cannot talk to emacs
  2019-10-01 18:05     ` Stefan Kangas
@ 2019-10-01 18:39       ` Eli Zaretskii
  2019-10-01 18:54         ` Stefan Kangas
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2019-10-01 18:39 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 20675, bruce.korb

> From: Stefan Kangas <stefan@marxist.se>
> Date: Tue, 1 Oct 2019 20:05:49 +0200
> Cc: 20675@debbugs.gnu.org
> 
> I see that server-socket-dir is documented in the Emacs FAQ, but not
> at all in the manual.

That's because the right way of controlling this is by customizing
server-name, not server-socket-dir.  See the user manual about
server-name.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#20675: 24.3; emacsclient cannot talk to emacs
  2019-10-01 18:39       ` Eli Zaretskii
@ 2019-10-01 18:54         ` Stefan Kangas
  2019-10-01 19:13           ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Kangas @ 2019-10-01 18:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 20675, Bruce Korb

Eli Zaretskii <eliz@gnu.org> writes:

> > I see that server-socket-dir is documented in the Emacs FAQ, but not
> > at all in the manual.
>
> That's because the right way of controlling this is by customizing
> server-name, not server-socket-dir.  See the user manual about
> server-name.

Right, but then it still seems like the documentation has a problem.

For starters, server-socket-dir is extensively documented in the FAQ,
while server-name is not at all mentioned.  Does that really make
sense if we want users to use server-name?

From the FAQ:

> Emacs by default creates a Unix domain socket
> named ‘server’ in a well-known directory, typically
> ‘$XDG_RUNTIME_DIR/emacs’ if Emacs is running under an X Window
> System desktop and ‘$TMPDIR/emacsUSERID’ otherwise.  See the
> variable ‘server-socket-dir’.  Traditionally, Emacs used
> ‘$TMPDIR/emacsUSERID’ even when running under an X desktop; if you
> prefer this traditional (and less-secure) behavior, you can set the
> environment variable ‘EMACS_SOCKET_NAME’ to
> ‘$TMPDIR/emacsUSERID/server’ before invoking Emacs and
> ‘emacsclient’, although it will be your responsibility to create
> the directory ‘$TMPDIR/emacsUSERID’ with appropriate ownership and
> permissions.

Perhaps this entire text should be moved to the doc string of the
sparsely documented server-socket-dir, with a note that the user
should use server-name instead?  And the FAQ updated to direct users
to use server-name?

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#20675: 24.3; emacsclient cannot talk to emacs
  2019-10-01 18:54         ` Stefan Kangas
@ 2019-10-01 19:13           ` Eli Zaretskii
  2019-10-02 13:37             ` Stefan Kangas
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2019-10-01 19:13 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 20675, bruce.korb

> From: Stefan Kangas <stefan@marxist.se>
> Date: Tue, 1 Oct 2019 20:54:31 +0200
> Cc: Bruce Korb <bruce.korb@gmail.com>, 20675@debbugs.gnu.org
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > > I see that server-socket-dir is documented in the Emacs FAQ, but not
> > > at all in the manual.
> >
> > That's because the right way of controlling this is by customizing
> > server-name, not server-socket-dir.  See the user manual about
> > server-name.
> 
> Right, but then it still seems like the documentation has a problem.

The FAQ has a problem, yes.  Why you looked there instead of the
manual is another question ;-)

> For starters, server-socket-dir is extensively documented in the FAQ,
> while server-name is not at all mentioned.  Does that really make
> sense if we want users to use server-name?

The FAQ is wrong and should be fixed.  server-socket-dir is a defvar,
whereas server-name is a defcustom, and that speaks volumes regarding
which one is user-level variable.

> >From the FAQ:
> 
> > Emacs by default creates a Unix domain socket
> > named ‘server’ in a well-known directory, typically
> > ‘$XDG_RUNTIME_DIR/emacs’ if Emacs is running under an X Window
> > System desktop and ‘$TMPDIR/emacsUSERID’ otherwise.  See the
> > variable ‘server-socket-dir’.  Traditionally, Emacs used
> > ‘$TMPDIR/emacsUSERID’ even when running under an X desktop; if you
> > prefer this traditional (and less-secure) behavior, you can set the
> > environment variable ‘EMACS_SOCKET_NAME’ to
> > ‘$TMPDIR/emacsUSERID/server’ before invoking Emacs and
> > ‘emacsclient’, although it will be your responsibility to create
> > the directory ‘$TMPDIR/emacsUSERID’ with appropriate ownership and
> > permissions.
> 
> Perhaps this entire text should be moved to the doc string of the
> sparsely documented server-socket-dir, with a note that the user
> should use server-name instead?  And the FAQ updated to direct users
> to use server-name?

I actually don't understand why do we have this text in the FAQ.  The
user manual documents this facility clearly enough (AFAIK), so the
most the FAQ should do is point to the manual.  Or maybe this whole
question should be deleted from the FAQ.  Does it say something that
the manual doesn't?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#20675: 24.3; emacsclient cannot talk to emacs
  2019-10-01 19:13           ` Eli Zaretskii
@ 2019-10-02 13:37             ` Stefan Kangas
  2019-10-02 15:29               ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Kangas @ 2019-10-02 13:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 20675, Bruce Korb

[-- Attachment #1: Type: text/plain, Size: 747 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

> > Right, but then it still seems like the documentation has a problem.
>
> The FAQ has a problem, yes.  Why you looked there instead of the
> manual is another question ;-)

In my defense, I actually looked at both.  :-)

> I actually don't understand why do we have this text in the FAQ.  The
> user manual documents this facility clearly enough (AFAIK), so the
> most the FAQ should do is point to the manual.  Or maybe this whole
> question should be deleted from the FAQ.

For now, maybe it's enough to just remove the details on
server-socket-dir from the FAQ, and add a reference to the manual
where users can find the documentation on server-name.  Patch
attached; WDYT?

Best regards,
Stefan Kangas

[-- Attachment #2: 0001-Don-t-mention-server-socket-dir-in-FAQ.patch --]
[-- Type: application/octet-stream, Size: 2076 bytes --]

From 81291d0e883d46163ac0103b737d45fcb8ecaf55 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Wed, 2 Oct 2019 15:25:57 +0200
Subject: [PATCH] Don't mention server-socket-dir in FAQ

server-socket-dir is a defvar, and users should use the defcustom
server-name instead.

* doc/misc/efaq.texi (Using an already running Emacs process): Remove
details on server-socket-dir, refer to Emacs Manual.  (Bug#20675)
---
 doc/misc/efaq.texi | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi
index 219ad248cc..5a81fc0094 100644
--- a/doc/misc/efaq.texi
+++ b/doc/misc/efaq.texi
@@ -1990,19 +1990,6 @@ Using an already running Emacs process
 (if (@var{some conditions are met}) (server-start))
 @end lisp
 
-When this is done, Emacs by default creates a Unix domain socket named
-@file{server} in a well-known directory, typically
-@file{$XDG_RUNTIME_DIR/emacs} if Emacs is running under an X Window System
-desktop and @file{$TMPDIR/emacs@var{userid}} otherwise.  See the variable
-@code{server-socket-dir}.  Traditionally, Emacs used
-@file{$TMPDIR/emacs@var{userid}} even when running under an X desktop;
-if you prefer this traditional (and less-secure) behavior, you
-can set the environment variable @env{EMACS_SOCKET_NAME} to
-@samp{$TMPDIR/emacs@var{userid}/server} before invoking Emacs and
-@samp{emacsclient}, although it will be your responsibility to create
-the directory @samp{$TMPDIR/emacs@var{userid}} with appropriate
-ownership and permissions.
-
 To get your news reader, mail reader, etc., to invoke
 @samp{emacsclient}, try setting the environment variable @code{EDITOR}
 (or sometimes @code{VISUAL}) to the value @samp{emacsclient}.  You may
@@ -2045,6 +2032,8 @@ Using an already running Emacs process
 
 @end itemize
 
+For more information, @xref{Emacs Server,,, emacs, The GNU Emacs Manual}.
+
 @node Compiler error messages
 @section How do I make Emacs recognize my compiler's funny error messages?
 @cindex Compiler error messages, recognizing
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#20675: 24.3; emacsclient cannot talk to emacs
  2019-10-02 13:37             ` Stefan Kangas
@ 2019-10-02 15:29               ` Eli Zaretskii
  2019-10-02 15:33                 ` Stefan Kangas
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2019-10-02 15:29 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 20675, bruce.korb

> From: Stefan Kangas <stefan@marxist.se>
> Date: Wed, 2 Oct 2019 15:37:15 +0200
> Cc: Bruce Korb <bruce.korb@gmail.com>, 20675@debbugs.gnu.org
> 
> > I actually don't understand why do we have this text in the FAQ.  The
> > user manual documents this facility clearly enough (AFAIK), so the
> > most the FAQ should do is point to the manual.  Or maybe this whole
> > question should be deleted from the FAQ.
> 
> For now, maybe it's enough to just remove the details on
> server-socket-dir from the FAQ, and add a reference to the manual
> where users can find the documentation on server-name.  Patch
> attached; WDYT?

Fine with me, thanks.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#20675: 24.3; emacsclient cannot talk to emacs
  2019-10-02 15:29               ` Eli Zaretskii
@ 2019-10-02 15:33                 ` Stefan Kangas
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Kangas @ 2019-10-02 15:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Bruce Korb, 20675-done

Eli Zaretskii <eliz@gnu.org> writes:

> Fine with me, thanks.

Thanks; pushed as commit 9cd3b50ca8.  I see nothing more to do here,
so I'm also closing this bug report.

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-10-02 15:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-27 18:09 bug#20675: 24.3; emacsclient cannot talk to emacs Bruce Korb
2019-09-29 23:46 ` Stefan Kangas
2019-10-01 17:31   ` Bruce Korb
2019-10-01 18:05     ` Stefan Kangas
2019-10-01 18:39       ` Eli Zaretskii
2019-10-01 18:54         ` Stefan Kangas
2019-10-01 19:13           ` Eli Zaretskii
2019-10-02 13:37             ` Stefan Kangas
2019-10-02 15:29               ` Eli Zaretskii
2019-10-02 15:33                 ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).