GNU bug report logs - #20675
24.3; emacsclient cannot talk to emacs

Previous Next

Package: emacs;

Reported by: Bruce Korb <bruce.korb <at> gmail.com>

Date: Wed, 27 May 2015 18:10:03 UTC

Severity: minor

Found in version 24.3

Done: Stefan Kangas <stefan <at> marxist.se>

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 20675 in the body.
You can then email your comments to 20675 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#20675; Package emacs. (Wed, 27 May 2015 18:10:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Bruce Korb <bruce.korb <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 27 May 2015 18:10:04 GMT) Full text and rfc822 format available.

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

From: Bruce Korb <bruce.korb <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; emacsclient cannot talk to emacs
Date: Wed, 27 May 2015 11:09:26 -0700
From: Bruce Korb <bruce.korb <at> gmail.com>
To: bug-gnu-emacs <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20675; Package emacs. (Sun, 29 Sep 2019 23:47:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Bruce Korb <bruce.korb <at> gmail.com>
Cc: 20675 <at> debbugs.gnu.org
Subject: Re: bug#20675: 24.3; emacsclient cannot talk to emacs
Date: Mon, 30 Sep 2019 01:46:22 +0200
Bruce Korb <bruce.korb <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20675; Package emacs. (Tue, 01 Oct 2019 17:33:02 GMT) Full text and rfc822 format available.

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

From: Bruce Korb <bruce.korb <at> gmail.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 20675 <at> debbugs.gnu.org
Subject: Re: bug#20675: 24.3; emacsclient cannot talk to emacs
Date: Tue, 1 Oct 2019 10:31:22 -0700
On Sun, Sep 29, 2019 at 4:46 PM Stefan Kangas <stefan <at> 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. :)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20675; Package emacs. (Tue, 01 Oct 2019 18:07:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Bruce Korb <bruce.korb <at> gmail.com>
Cc: 20675 <at> debbugs.gnu.org
Subject: Re: bug#20675: 24.3; emacsclient cannot talk to emacs
Date: Tue, 1 Oct 2019 20:05:49 +0200
Bruce Korb <bruce.korb <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20675; Package emacs. (Tue, 01 Oct 2019 18:41:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 20675 <at> debbugs.gnu.org, bruce.korb <at> gmail.com
Subject: Re: bug#20675: 24.3; emacsclient cannot talk to emacs
Date: Tue, 01 Oct 2019 21:39:54 +0300
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Tue, 1 Oct 2019 20:05:49 +0200
> Cc: 20675 <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20675; Package emacs. (Tue, 01 Oct 2019 18:55:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 20675 <at> debbugs.gnu.org, Bruce Korb <bruce.korb <at> gmail.com>
Subject: Re: bug#20675: 24.3; emacsclient cannot talk to emacs
Date: Tue, 1 Oct 2019 20:54:31 +0200
Eli Zaretskii <eliz <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20675; Package emacs. (Tue, 01 Oct 2019 19:14:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 20675 <at> debbugs.gnu.org, bruce.korb <at> gmail.com
Subject: Re: bug#20675: 24.3; emacsclient cannot talk to emacs
Date: Tue, 01 Oct 2019 22:13:06 +0300
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Tue, 1 Oct 2019 20:54:31 +0200
> Cc: Bruce Korb <bruce.korb <at> gmail.com>, 20675 <at> debbugs.gnu.org
> 
> Eli Zaretskii <eliz <at> 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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20675; Package emacs. (Wed, 02 Oct 2019 13:38:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 20675 <at> debbugs.gnu.org, Bruce Korb <bruce.korb <at> gmail.com>
Subject: Re: bug#20675: 24.3; emacsclient cannot talk to emacs
Date: Wed, 2 Oct 2019 15:37:15 +0200
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> 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
[0001-Don-t-mention-server-socket-dir-in-FAQ.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20675; Package emacs. (Wed, 02 Oct 2019 15:30:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 20675 <at> debbugs.gnu.org, bruce.korb <at> gmail.com
Subject: Re: bug#20675: 24.3; emacsclient cannot talk to emacs
Date: Wed, 02 Oct 2019 18:29:03 +0300
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Wed, 2 Oct 2019 15:37:15 +0200
> Cc: Bruce Korb <bruce.korb <at> gmail.com>, 20675 <at> 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.




Reply sent to Stefan Kangas <stefan <at> marxist.se>:
You have taken responsibility. (Wed, 02 Oct 2019 15:34:02 GMT) Full text and rfc822 format available.

Notification sent to Bruce Korb <bruce.korb <at> gmail.com>:
bug acknowledged by developer. (Wed, 02 Oct 2019 15:34:02 GMT) Full text and rfc822 format available.

Message #34 received at 20675-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Bruce Korb <bruce.korb <at> gmail.com>, 20675-done <at> debbugs.gnu.org
Subject: Re: bug#20675: 24.3; emacsclient cannot talk to emacs
Date: Wed, 2 Oct 2019 17:33:04 +0200
Eli Zaretskii <eliz <at> 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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 31 Oct 2019 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 175 days ago.

Previous Next


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