From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Antipov Newsgroups: gmane.emacs.bugs Subject: bug#17975: 24.3.92; assertion failure deleting frames with varying names for the same display (and, using multiple X11 connections in that case too) Date: Wed, 09 Jul 2014 09:37:49 +0400 Message-ID: <53BCD52D.6090700@yandex.ru> References: <6ea98jsjtd.fsf@just-testing.permabit.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050705060003040301090209" X-Trace: ger.gmane.org 1405000999 9766 80.91.229.3 (10 Jul 2014 14:03:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 10 Jul 2014 14:03:19 +0000 (UTC) Cc: 17975@debbugs.gnu.org To: Ken Raeburn Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 10 16:03:12 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1X5EwJ-0004WU-Ex for geb-bug-gnu-emacs@m.gmane.org; Thu, 10 Jul 2014 16:03:11 +0200 Original-Received: from localhost ([::1]:38208 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5EwJ-0005gf-1x for geb-bug-gnu-emacs@m.gmane.org; Thu, 10 Jul 2014 10:03:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4kb0-0003hp-NI for bug-gnu-emacs@gnu.org; Wed, 09 Jul 2014 01:39:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4kat-0005g9-LJ for bug-gnu-emacs@gnu.org; Wed, 09 Jul 2014 01:39:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56335) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4kat-0005fi-Es for bug-gnu-emacs@gnu.org; Wed, 09 Jul 2014 01:39:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1X4kas-0003gX-JI for bug-gnu-emacs@gnu.org; Wed, 09 Jul 2014 01:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Antipov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 09 Jul 2014 05:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17975 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17975-submit@debbugs.gnu.org id=B17975.140488430914097 (code B ref 17975); Wed, 09 Jul 2014 05:39:02 +0000 Original-Received: (at 17975) by debbugs.gnu.org; 9 Jul 2014 05:38:29 +0000 Original-Received: from localhost ([127.0.0.1]:47485 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X4kaK-0003fJ-AK for submit@debbugs.gnu.org; Wed, 09 Jul 2014 01:38:28 -0400 Original-Received: from forward2o.mail.yandex.net ([37.140.190.31]:39457) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X4kaF-0003et-Ae for 17975@debbugs.gnu.org; Wed, 09 Jul 2014 01:38:24 -0400 Original-Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [37.140.190.26]) by forward2o.mail.yandex.net (Yandex) with ESMTP id C86594861394; Wed, 9 Jul 2014 09:38:16 +0400 (MSK) Original-Received: from smtp1o.mail.yandex.net (localhost [127.0.0.1]) by smtp1o.mail.yandex.net (Yandex) with ESMTP id 7DE2ADE2428; Wed, 9 Jul 2014 09:38:16 +0400 (MSK) Original-Received: from 127.gprs.mts.ru (127.gprs.mts.ru [213.87.143.127]) by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id JFAVDpjBwJ-cDIWH4K5; Wed, 9 Jul 2014 09:38:14 +0400 (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client certificate not present) X-Yandex-Uniq: f168af4d-b770-4678-9fcc-4592214bcabb DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1404884295; bh=dnj+utqPeKjChm9IT+4UiIkPMU0yrxmMDXSqHThM3E4=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type; b=ppbwHF1g60ojICuy1T2LiCt7V+5fnxkd5rNuZJxrQWlfeY7MP4luVJV36H4NngpYK gVB8J6+tLURx75YvWRA8QZkAgpMitMJ0i1bAy7xcgLS9EG2CfvLBPy/1uoDOdp2INc lJOe2wY0PTmV0moFipRCoWWKpktPIpX4JZcdBZ5U= Authentication-Results: smtp1o.mail.yandex.net; dkim=pass header.i=@yandex.ru User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <6ea98jsjtd.fsf@just-testing.permabit.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:91379 Archived-At: This is a multi-part message in MIME format. --------------050705060003040301090209 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 07/08/2014 11:59 PM, Ken Raeburn wrote: > This is a simplified version of a crash I got using emacsclient, daemon > mode, and desktop-save-mode. My saved desktop configuration somehow has > frames with different names for the same local display, perhaps because > window manager buttons I use to invoke emacsclient cause ":0.0" to be > used, and my xterm shells have DISPLAY set to ":0". > > Emacs is compiled with "--enable-checking --with-x-toolkit=lucid". > > Recipe: > 1. emacs -Q --daemon > 2. DISPLAY=:0 emacsclient -c -n > 3. DISPLAY=:0.0 emacsclient -c -n > 4. Use a window-manager button to delete the first Emacs window. > 5. Emacs crashes with an assertion failure. Reproduced. The whole thing looks like a mystery (perhaps Xlib makes a difference between :0 and :0.0 somewhere in its innards), but this workaround works for me. Can you please try it too? Dmitry --------------050705060003040301090209 Content-Type: text/x-patch; name="bug17975.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="bug17975.patch" === modified file 'lib-src/emacsclient.c' --- lib-src/emacsclient.c 2014-06-17 16:09:19 +0000 +++ lib-src/emacsclient.c 2014-07-09 05:30:11 +0000 @@ -82,6 +82,8 @@ #include #include +#include + #ifndef VERSION #define VERSION "unspecified" #endif @@ -1517,6 +1519,31 @@ #endif /* WINDOWSNT */ } +/* Return the canonical HOST:SEQUENCE.SCREEN name of DISPLAY. + For some weird reason, this is important for XIM (Bug#17975). */ + +static char * +x_canonical_display (char *display) +{ + char host[256]; /* Max. FQDN length is 255. */ + int sequence, screen; + + if (sscanf (display, "%s:%d.%d", host, &sequence, &screen) == 3) + /* canonical */ ; + else if (sscanf (display, "%d:%d", &sequence, &screen) == 2 + || sscanf (display, ":%d:%d", &sequence, &screen) == 2) + { + display = xmalloc (4 + INT_BUFSIZE_BOUND (int) * 2 + 3); + sprintf (display, "unix:%d.%d", sequence, screen); + } + else if (sscanf (display, ":%d", &sequence) == 1) + { + display = xmalloc (4 + INT_BUFSIZE_BOUND (int) + 4); + sprintf (display, "unix:%d.0", sequence); + } + return display; +} + int main (int argc, char **argv) { @@ -1585,6 +1612,9 @@ w32_give_focus (); #endif /* HAVE_NTGUI */ + if (display) + display = x_canonical_display ((char *) display); + /* Send over our environment and current directory. */ if (!current_frame) { --------------050705060003040301090209--