--- Begin Message ---
Subject: |
24.4; make-frame-on-display fails if emacs started with -nw |
Date: |
Tue, 25 Nov 2014 17:28:27 +1300 |
emacs -nw
M-x make-frame-on-display RET
When prompted: myhost:0 RET
Expected result:
A new X11 frame is created on the specified X11 display 'myhost:0'
Actual result:
In minibuffer, the following message appears:
Display myhost:0 can't be opened
Note:
DISPLAY=myhost:0 emacs
works fine, and make-frame-on-display works. It's only when starting
emacs with -nw (or, more importantly, --daemon) that
make-frame-on-display subsequently fails.
This is *not* a simple X authorization problem or anything like that.
The strace output from the point where emacs connects to the X server to
when it closes the connection, without having read or written any data,
follows (actual IP address of target X server host elided and replaced
with 192.168.1.2):
----
socket(PF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_TCP) = 10
setsockopt(10, SOL_TCP, TCP_NODELAY, [1], 4) = 0
setsockopt(10, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
connect(10, {sa_family=AF_INET, sin_port=htons(6000),
sin_addr=inet_addr("192.168.1.2")}, 16) = ? ERESTARTSYS (To be restarted)
--- SIGIO (I/O possible) @ 0 (0) ---
rt_sigreturn(0x1d) = -1 EINTR (Interrupted system call)
close(10) = 0
----
In GNU Emacs 24.4.1 (x86_64-unknown-linux-gnu, X toolkit)
of 2014-11-25 on ak2
Configured using:
`configure --without-toolkit-scroll-bars --with-x
--with-x-toolkit=lucid --without-xft'
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
rcirc-track-minor-mode: t
show-paren-mode: t
tooltip-mode: t
electric-indent-mode: t
mouse-wheel-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
line-number-mode: t
transient-mark-mode: t
Recent input:
SPC L i n u x SPC d e s k t o p SPC s y s t e m , SPC
j u s t SPC s a y : RET D I S P L A Y = : 0 SPC e m
a c s SPC - n w RET M - x SPC m a k e - f r a m e -
o n - d i s p l a y RET W h e n SPC p r o m p t e d
SPC e n t e r : SPC : 0 RET I f SPC a SPC n e w SPC
f r a m e SPC a p p e a r s , SPC t h e SPC n i t SPC
i DEL DEL DEL DEL DEL DEL n SPC i t SPC i s SPC w o
r k i n g RET I f SPC t h e SPC t e x t SPC ' D i s
p l a y SPC : 0 SPC c a n ' t SPC b e SPC o p e n e
d ' SPC a p p e a r s SPC i n SPC t h e SPC m i n i
b u f f e r , SPC t h e n SPC t h e SPC b u g ESC b
ESC b y o u SPC h a v e SPC RET ESC [ > 0 ; 2 4 2 ;
0 c ESC ] 1 1 ; r g b : f f f f / f f f f / f f f f
ESC \ ESC x r e p o TAB r t TAB RET
Recent messages:
When done with this frame, type C-x 5 0
x-initialize-window-system: Display 10.87.0.1:0 can't be opened
x-initialize-window-system: Display 10.89.6.1:0 can't be opened [2 times]
Connecting to chat.freenode.net...done
Quit
Making completion list...
Rcirc-Track minor mode disabled
Rcirc-Track minor mode enabled
When done with this frame, type C-x 5 0
Making completion list...
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message format-spec rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils help-mode
easymenu disp-table network-stream auth-source eieio byte-opt bytecomp
byte-compile cconv eieio-core gnus-util mm-util help-fns mail-prsvr
password-cache starttls tls rcirc ring xterm server jabber-autoloads
package epg-config escreen time-date paren cus-start cus-load tooltip
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
gfilenotify dynamic-setting x-toolkit x multi-tty emacs)
Memory information:
((conses 16 144895 13629)
(symbols 48 21822 0)
(miscs 40 256 529)
(strings 32 22112 4517)
(string-bytes 1 584096)
(vectors 16 11221)
(vector-slots 8 410639 4818)
(floats 8 80 297)
(intervals 56 4036 233)
(buffers 960 26)
(heap 1024 23508 585))
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#19175: 24.4; make-frame-on-display fails if emacs started with -nw |
Date: |
Sun, 29 Mar 2015 21:18:06 +0200 |
Fixed in the emacs-24 branch.
Jan D.
> 29 mar 2015 kl. 19:20 skrev Eli Zaretskii <address@hidden>:
>
>> Date: Sun, 29 Mar 2015 19:09:48 +0200
>> From: Jan Djärv <address@hidden>
>> CC: address@hidden, address@hidden
>>
>> index fedaa0f..1f48262 100644
>> --- a/src/gtkutil.c
>> +++ b/src/gtkutil.c
>> @@ -167,7 +167,9 @@ xg_display_open (char *display_name, Display **dpy)
>> {
>> GdkDisplay *gdpy;
>>
>> + unrequest_sigio ();
>> gdpy = gdk_display_open (display_name);
>> + request_sigio ();
>> if (!gdpy_def && gdpy)
>> {
>> gdpy_def = gdpy;
>> diff --git a/src/xterm.c b/src/xterm.c
>> index 4ca1e13..8284ed9 100644
>> --- a/src/xterm.c
>> +++ b/src/xterm.c
>> @@ -9719,7 +9719,10 @@ get_bits_and_offset (unsigned long mask, int *bits,
>> int
>> *offset)
>> bool
>> x_display_ok (const char *display)
>> {
>> - Display *dpy = XOpenDisplay (display);
>> + Display *dpy;
>> + unrequest_sigio ();
>> + dpy = XOpenDisplay (display);
>> + request_sigio ();
>> return dpy ? (XCloseDisplay (dpy), 1) : 0;
>> }
>>
>> @@ -9811,7 +9814,9 @@ x_term_init (Lisp_Object display_name, char
>> *xrm_option,
>> char *resource_name)
>>
>> /* gtk_init does set_locale. Fix locale before and after. */
>> fixup_locale ();
>> + unrequest_sigio ();
>> gtk_init (&argc, &argv2);
>> + request_sigio ();
>> fixup_locale ();
>>
>> g_log_remove_handler ("GLib", id);
>> @@ -9861,10 +9866,12 @@ x_term_init (Lisp_Object display_name, char
>> *xrm_option, char *resource_name)
>> argv[argc++] = xrm_option;
>> }
>> turn_on_atimers (0);
>> + unrequest_sigio ();
>> dpy = XtOpenDisplay (Xt_app_con, SSDATA (display_name),
>> resource_name, EMACS_CLASS,
>> emacs_options, XtNumber (emacs_options),
>> &argc, argv);
>> + request_sigio ();
>> turn_on_atimers (1);
>>
>> #ifdef HAVE_X11XTR6
>> @@ -9875,7 +9882,9 @@ x_term_init (Lisp_Object display_name, char
>> *xrm_option,
>> char *resource_name)
>>
>> #else /* not USE_X_TOOLKIT */
>> XSetLocaleModifiers ("");
>> + unrequest_sigio ();
>> dpy = XOpenDisplay (SSDATA (display_name));
>> + request_sigio ();
>> #endif /* not USE_X_TOOLKIT */
>> #endif /* not USE_GTK*/
>
> Thanks, this looks safe enough to me. Just add some comments to
> explain the need.
>
> I hope Nicolas won't mind preparing a new tarball for the release.
--- End Message ---