Subject: bug#1467 closed by Андрей Парамонов<[email-masked]> (Re: Bug#539809: emacs23-gtk: emacsclient cannot connect to daemon run from tty1)

From: [email-masked] (Emacs bug Tracking System)
Date: Wed, 05 Aug 2009 00:55:06 +0000

This is an automatic notification regarding your bug report
which was filed against the emacs package:

#1467: 23.0.60; Cannot "emacsclient -c" to daemon started from tt1

It has been closed by Андрей Парамонов <[email-masked]>.

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact Андрей Парамонов <[email-masked]> by
replying to this email.

-- 
1467: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=1467
Emacs Bug Tracking System
Contact [email-masked] with problems

Subject: Re: Bug#539809: emacs23-gtk: emacsclient cannot connect to daemon run from tty1
From: Андрей Парамонов <[email-masked]>
To: "Trent W. Buck" <[email-masked]>
Cc: [email-masked]
Date: Tue, 4 Aug 2009 23:42:30 +0400

2009/8/4 Trent W. Buck <[email-masked]>:
> Is the XAUTHORITY environment variable defined within your X session?
>
> If so, the reason the Emacs daemon can't connect to your X server is
> because it is trying to use ~/.Xauthority, but the file is in some
> other place.
>
> GDM puts the .Xauthority file in a different place when $HOME is on a
> root-squashed NFS filesystem, because when the file is created GDM
> runs as root, and can't write the file to ~/.Xauthority as normal.  It
> sets the XAUTHORITY environment variable to the other place (in
> /tmp/), so all the child processes know to look there.
>
> But emacs --daemon was started outside of the GDM process tree, so it
> doesn't "see" the XAUTHORITY environment variable.
>
> When I ran into this problem (using screen, not emacs --daemon), I
> worked around it with the following code in my .xsession file:
>
>    ## Dance so screen subprocesses can talk to GDM-spawned X servers.
>    if test -n "$XAUTHORITY"
>    then
>        xauth extract - $DISPLAY |
>        xauth -f ~/.Xauthority merge -
>        unset XAUTHORITY
>    fi
>
> Note that depending on your DM, .xsession may be called .xinitrc or
> .Xclients.  Typically you also have to choose "default X session" or
> similar, rather than "GNOME" or whatever.
>

Thank you for a very helpful response!

I don't use NFS, but the problem was indeed in my ~/.Xauthority (it
was owned by root and 600 for some reason). I've removed my
~/.Xauthority and restarted X, and now my Emacs can survive X crash
:-)

Andrey
>From [email-masked] Mon Dec  1 12:03:46 2008
To: [email-masked]
CC: [email-masked]
Subject: 23.0.60; Cannot "emacsclient -c" to daemon started from tt1
From: pent <[email-masked]>
Date: Mon, 01 Dec 2008 23:03:29 +0300

0) Start X session.

1) Switch to tty1 or any other console terminal and run
  
   $ emacs --daemon

   Emacs server loads (correct).

2) Make sure you can connect to it by running

   $ emacsclient -t

   This should work from both tty and X sessions (correct).

3) Switch to X session and run

   $ emacsclient -c

   This fails with message

   Waiting for Emacs...
   *ERROR*: Display :0.0 can't be opened

I think it would be really nice if Emacs could easily survive X crash.

I'm ready to provide any additional info,
Andrey

In GNU Emacs 23.0.60.1 (i486-pc-linux-gnu, GTK+ Version 2.12.11)
 of 2008-11-30 on elegiac, modified by Debian
 (emacs-snapshot package, version 1:20081129-1)
Windowing system distributor `The X.Org Foundation', version 11.0.10402000
configured using `configure  '--build' 'i486-linux-gnu' '--host' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/23.0.60/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.0.60/site-lisp:/usr/share/emacs/site-lisp' '--with-x=yes' '--with-x-toolkit=gtk' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ru_RU.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Info

Minor modes in effect:
  delete-selection-mode: t
  pc-selection-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  global-visual-line-mode: t
  visual-line-mode: t
  transient-mark-mode: t