From unknown Sat Aug 16 15:57:19 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#1052 <1052@debbugs.gnu.org> To: bug#1052 <1052@debbugs.gnu.org> Subject: Status: segfault when resuming emacsclient -t in an xterm Reply-To: bug#1052 <1052@debbugs.gnu.org> Date: Sat, 16 Aug 2025 22:57:19 +0000 retitle 1052 segfault when resuming emacsclient -t in an xterm reassign 1052 emacs submitter 1052 Dan Nicolaescu severity 1052 normal thanks From dann@mothra.ics.uci.edu Mon Sep 29 10:46:59 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-4.6 required=4.0 tests=AWL,BAYES_00,FOURLA, IMPRONONCABLE_2,MURPHY_WRONG_WORD2,RCVD_IN_DNSWL_LOW autolearn=no version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 29 Sep 2008 17:46:59 +0000 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8THktFj025747 for ; Mon, 29 Sep 2008 10:46:56 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KkMpi-0002kK-Or for bug-gnu-emacs@gnu.org; Mon, 29 Sep 2008 13:46:54 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KkMph-0002iU-6o for bug-gnu-emacs@gnu.org; Mon, 29 Sep 2008 13:46:53 -0400 Received: from [199.232.76.173] (port=44919 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KkMpg-0002iG-Vr for bug-gnu-emacs@gnu.org; Mon, 29 Sep 2008 13:46:53 -0400 Received: from sallyv2.ics.uci.edu ([128.195.1.120]:49425) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1KkMpg-0001P9-DB for bug-gnu-emacs@gnu.org; Mon, 29 Sep 2008 13:46:52 -0400 Received: from mothra.ics.uci.edu (mothra.ics.uci.edu [128.195.6.93]) by sallyv2.ics.uci.edu (8.13.7+Sun/8.13.7) with ESMTP id m8THkRZ7024501 for ; Mon, 29 Sep 2008 10:46:27 -0700 (PDT) Received: (from dann@localhost) by mothra.ics.uci.edu (8.13.8+Sun/8.13.6/Submit) id m8THkQE1005918; Mon, 29 Sep 2008 10:46:26 -0700 (PDT) Date: Mon, 29 Sep 2008 10:46:26 -0700 (PDT) Message-Id: <200809291746.m8THkQE1005918@mothra.ics.uci.edu> From: Dan Nicolaescu To: bug-gnu-emacs@gnu.org Subject: segfault when resuming emacsclient -t in an xterm Lines: 115 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-ICS-MailScanner-Information: Please contact the ISP for more information X-ICS-MailScanner-ID: m8THkRZ7024501 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (score=-1.44, required 5, autolearn=disabled, ALL_TRUSTED -1.44) X-ICS-MailScanner-From: dann@mothra.ics.uci.edu X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (beta) This change: 2008-03-29 Stefan Monnier * xt-mouse.el (xterm-mouse-mode): Use delete-terminal-functions. (xterm-mouse-handle-delete-frame): Delete. * term/xterm.el (terminal-init-xterm): Use delete-terminal-functions. (xterm-turn-on-modify-other-keys, xterm-turn-off-modify-other-keys) (xterm-remove-modify-other-keys): Lookup terminal rather than frame in xterm-modify-other-keys-terminal-list. causes the following: emacs -Q -f server-start RET in another xterm do: emacsclient -t RET C-z emacsclient -t RET C-z fg C-x C-c at this point emacs segfaults with the following backtrace: Program received signal SIGSEGV, Segmentation fault. 0x007c3c81 in fwrite () from /lib/libc.so.6 Missing separate debuginfos, use: debuginfo-install Xaw3d.i386 e2fsprogs.i386 giflib.i386 glibc.i686 gpm.i386 libICE.i386 libSM.i386 libX11.i386 libXau.i386 libXcursor.i386 libXdmcp.i386 libXext.i386 libXfixes.i386 libXmu.i386 libXpm.i386 libXrender.i386 libXt.i386 libjpeg.i386 libpng.i386 libtiff.i386 libxcb.i386 ncurses.i386 zlib.i386 (gdb) bt #0 0x007c3c81 in fwrite () from /lib/libc.so.6 #1 0x08052f7a in Fsend_string_to_terminal (string=143248211, terminal=137808073) at /tmp/emacs/src/dispnew.c:6473 #2 0x0816ed97 in Ffuncall (nargs=2, args=0xbf8e3b00) at /tmp/emacs/src/eval.c:3047 #3 0x081a3680 in Fbyte_code (bytestr=143248515, vector=146901764, maxdepth=) at /tmp/emacs/src/bytecode.c:678 #4 0x08170b73 in funcall_lambda (fun=146932996, nargs=1, arg_vector=0xbf8e3df4) at /tmp/emacs/src/eval.c:3231 #5 0x0816ea9b in Ffuncall (nargs=2, args=0xbf8e3df0) at /tmp/emacs/src/eval.c:3101 #6 0x0816fe01 in run_hook_with_args (nargs=2, args=0xbf8e3df0, cond=to_completion) at /tmp/emacs/src/eval.c:2703 #7 0x0816ec36 in Ffuncall (nargs=3, args=0xbf8e3dec) at /tmp/emacs/src/eval.c:3025 #8 0x0816dd6d in internal_condition_case_2 (bfun=0x816e8f0 , nargs=3, args=0xbf8e3dec, handlers=137808121, hfun=0x8076a40 ) at /tmp/emacs/src/eval.c:1610 #9 0x0807f2aa in safe_call (nargs=3, args=0xbf8e3dec) at /tmp/emacs/src/xdisp.c:2379 #10 0x0807f2fb in safe_call2 (fn=137949729, arg1=138024513, arg2=144406428) at /tmp/emacs/src/xdisp.c:2420 #11 0x080cac9d in Fdelete_terminal (terminal=144406428, force=137808121) at /tmp/emacs/src/terminal.c:331 #12 0x0805e8b3 in Fdelete_frame (frame=147003460, force=137808121) at /tmp/emacs/src/frame.c:1525 #13 0x0816ed97 in Ffuncall (nargs=2, args=0xbf8e3f00) at /tmp/emacs/src/eval.c:3047 #14 0x081a3680 in Fbyte_code (bytestr=143528187, vector=146950748, maxdepth=) at /tmp/emacs/src/bytecode.c:678 #15 0x08170b73 in funcall_lambda (fun=147009116, nargs=1, arg_vector=0xbf8e4044) at /tmp/emacs/src/eval.c:3231 #16 0x0816ea9b in Ffuncall (nargs=2, args=0xbf8e4040) at /tmp/emacs/src/eval.c:3101 #17 0x081a3680 in Fbyte_code (bytestr=137997267, vector=144196452, maxdepth=) at /tmp/emacs/src/bytecode.c:678 #18 0x08170b73 in funcall_lambda (fun=144184804, nargs=2, arg_vector=0xbf8e4174) at /tmp/emacs/src/eval.c:3231 #19 0x0816ea9b in Ffuncall (nargs=3, args=0xbf8e4170) at /tmp/emacs/src/eval.c:3101 #20 0x081a3680 in Fbyte_code (bytestr=136424043, vector=136424060, maxdepth=) at /tmp/emacs/src/bytecode.c:678 #21 0x08170b73 in funcall_lambda (fun=136423996, nargs=1, arg_vector=0xbf8e42f4) at /tmp/emacs/src/eval.c:3231 #22 0x0816ea9b in Ffuncall (nargs=2, args=0xbf8e42f0) at /tmp/emacs/src/eval.c:3101 #23 0x0816c9ac in Fcall_interactively (function=143157089, record_flag=137808073, keys=137846508) at /tmp/emacs/src/callint.c:857 #24 0x0816ed7b in Ffuncall (nargs=4, args=0xbf8e44b0) at /tmp/emacs/src/eval.c:3050 #25 0x0816eec9 in call3 (fn=137972297, arg1=143157089, arg2=137808073, arg3=137808073) at /tmp/emacs/src/emacs.c:1724 Lisp Backtrace: "send-string-to-terminal" (0xbf8e3b04) "xterm-remove-modify-other-keys" (0xbf8e3df4) "run-hook-with-args" (0xbf8e3df0) "delete-frame" (0xbf8e3f04) "server-delete-client" (0xbf8e4044) "server-save-buffers-kill-terminal" (0xbf8e4174) "save-buffers-kill-terminal" (0xbf8e42f4) "call-interactively" (0xbf8e44b4) The reason is: (gdb) frame 1 #1 0x08052f7a in Fsend_string_to_terminal (string=143248211, terminal=137808073) at /tmp/emacs/src/dispnew.c:6473 6473 fwrite (SDATA (string), 1, SBYTES (string), tty->output); (gdb) p tty->output $1 = (FILE *) 0x0 The problem is that after the cited change `xterm-remove-modify-other-keys' calls `terminal-live-p' (it was previously using `frame-live-p') before calling `send-string-to-terminal'. `terminal-live-p' does not return false when tty->output is NULL ---> KABOOM. BTW, unlike what the cited ChangeLog says, `xterm-turn-off-modify-other-keys' still uses `frame-live-p'. From cyd@stupidchicken.com Tue Sep 30 10:05:06 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-3.8 required=4.0 tests=AWL,BAYES_00,FOURLA autolearn=no version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 1052) by emacsbugs.donarmstrong.com; 30 Sep 2008 17:05:07 +0000 Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8UH53iC016568 for <1052@emacsbugs.donarmstrong.com>; Tue, 30 Sep 2008 10:05:04 -0700 Received: by cyd.mit.edu (Postfix, from userid 1000) id 5FA3757E32A; Tue, 30 Sep 2008 13:06:02 -0400 (EDT) From: Chong Yidong To: Dan Nicolaescu Cc: Stefan Monnier , 1052@debbugs.gnu.org Subject: Re: segfault when resuming emacsclient -t in an xterm Date: Tue, 30 Sep 2008 13:06:02 -0400 Message-ID: <873ajho96t.fsf@cyd.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > The problem is that after the cited change > `xterm-remove-modify-other-keys' calls `terminal-live-p' (it was > previously using `frame-live-p') before calling > `send-string-to-terminal'. > > `terminal-live-p' does not return false when tty->output is NULL ---> > KABOOM. Looks like it's just a matter of checking tty->output, then. WDYT? *** trunk/src/dispnew.c.~1.419.~ 2008-09-28 16:09:43.000000000 -0400 --- trunk/src/dispnew.c 2008-09-30 13:02:21.000000000 -0400 *************** *** 6470,6477 **** fwrite (SDATA (string), 1, SBYTES (string), tty->termscript); fflush (tty->termscript); } ! fwrite (SDATA (string), 1, SBYTES (string), tty->output); ! fflush (tty->output); UNBLOCK_INPUT; return Qnil; } --- 6470,6480 ---- fwrite (SDATA (string), 1, SBYTES (string), tty->termscript); fflush (tty->termscript); } ! if (tty->output) ! { ! fwrite (SDATA (string), 1, SBYTES (string), tty->output); ! fflush (tty->output); ! } UNBLOCK_INPUT; return Qnil; } From dann@mothra.ics.uci.edu Tue Sep 30 11:19:11 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-6.2 required=4.0 tests=AWL,BAYES_00,FOURLA, HAS_BUG_NUMBER autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 1052) by emacsbugs.donarmstrong.com; 30 Sep 2008 18:19:12 +0000 Received: from sallyv2.ics.uci.edu (sallyv2.ics.uci.edu [128.195.1.120]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8UIJ9mQ003673 for <1052@emacsbugs.donarmstrong.com>; Tue, 30 Sep 2008 11:19:10 -0700 Received: from mothra.ics.uci.edu (mothra.ics.uci.edu [128.195.6.93]) by sallyv2.ics.uci.edu (8.13.7+Sun/8.13.7) with ESMTP id m8UIIHNq000778; Tue, 30 Sep 2008 11:18:21 -0700 (PDT) Received: (from dann@localhost) by mothra.ics.uci.edu (8.13.8+Sun/8.13.6/Submit) id m8UIIGFf003951; Tue, 30 Sep 2008 11:18:16 -0700 (PDT) Date: Tue, 30 Sep 2008 11:18:16 -0700 (PDT) Message-Id: <200809301818.m8UIIGFf003951@mothra.ics.uci.edu> From: Dan Nicolaescu To: Chong Yidong Cc: 1052@debbugs.gnu.org Subject: Re: bug#1052: segfault when resuming emacsclient -t in an xterm References: <873ajho96t.fsf@cyd.mit.edu> In-Reply-To: <873ajho96t.fsf@cyd.mit.edu> (Chong Yidong's message of "Tue, 30 Sep 2008 13:06:02 -0400") Lines: 44 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-ICS-MailScanner-Information: Please contact the ISP for more information X-ICS-MailScanner-ID: m8UIIHNq000778 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (score=-1.44, required 5, autolearn=disabled, ALL_TRUSTED -1.44) X-ICS-MailScanner-From: dann@mothra.ics.uci.edu Chong Yidong writes: > > The problem is that after the cited change > > `xterm-remove-modify-other-keys' calls `terminal-live-p' (it was > > previously using `frame-live-p') before calling > > `send-string-to-terminal'. > > > > `terminal-live-p' does not return false when tty->output is NULL ---> > > KABOOM. > > Looks like it's just a matter of checking tty->output, then. WDYT? Not sure it's a good idea. The test for `frame-live-p' was trying to make sure that the frame is OK and `send-string-to-terminal' would work. Not sure 1. why was it replaced with `terminal-live-p' 2. maybe `terminal-live-p' needs to be changed to detect this condition > *** trunk/src/dispnew.c.~1.419.~ 2008-09-28 16:09:43.000000000 -0400 > --- trunk/src/dispnew.c 2008-09-30 13:02:21.000000000 -0400 > *************** > *** 6470,6477 **** > fwrite (SDATA (string), 1, SBYTES (string), tty->termscript); > fflush (tty->termscript); > } > ! fwrite (SDATA (string), 1, SBYTES (string), tty->output); > ! fflush (tty->output); > UNBLOCK_INPUT; > return Qnil; > } > --- 6470,6480 ---- > fwrite (SDATA (string), 1, SBYTES (string), tty->termscript); > fflush (tty->termscript); > } > ! if (tty->output) > ! { > ! fwrite (SDATA (string), 1, SBYTES (string), tty->output); > ! fflush (tty->output); > ! } > UNBLOCK_INPUT; > return Qnil; > } From monnier@IRO.UMontreal.CA Tue Sep 30 15:06:33 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-6.3 required=4.0 tests=AWL,BAYES_00,FOURLA, HAS_BUG_NUMBER autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 1052) by emacsbugs.donarmstrong.com; 30 Sep 2008 22:06:34 +0000 Received: from chene.dit.umontreal.ca (chene.dit.umontreal.ca [132.204.246.20]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8UM6TEK011815 for <1052@emacsbugs.donarmstrong.com>; Tue, 30 Sep 2008 15:06:31 -0700 Received: from alfajor.home (vpn-132-204-232-132.acd.umontreal.ca [132.204.232.132]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id m8UM6SWo000388; Tue, 30 Sep 2008 18:06:28 -0400 Received: by alfajor.home (Postfix, from userid 20848) id CECBB1C3E8; Tue, 30 Sep 2008 18:06:27 -0400 (EDT) From: Stefan Monnier To: Dan Nicolaescu Cc: 1052@debbugs.gnu.org, Chong Yidong Subject: Re: bug#1052: segfault when resuming emacsclient -t in an xterm Message-ID: References: <873ajho96t.fsf@cyd.mit.edu> <200809301818.m8UIIGFf003951@mothra.ics.uci.edu> Date: Tue, 30 Sep 2008 18:06:27 -0400 In-Reply-To: <200809301818.m8UIIGFf003951@mothra.ics.uci.edu> (Dan Nicolaescu's message of "Tue, 30 Sep 2008 11:18:16 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3115=0 >> > The problem is that after the cited change >> > `xterm-remove-modify-other-keys' calls `terminal-live-p' (it was >> > previously using `frame-live-p') before calling >> > `send-string-to-terminal'. >> > >> > `terminal-live-p' does not return false when tty->output is NULL ---> >> > KABOOM. >> >> Looks like it's just a matter of checking tty->output, then. WDYT? > Not sure it's a good idea. > The test for `frame-live-p' was trying to make sure that the frame is OK > and `send-string-to-terminal' would work. > Not sure > 1. why was it replaced with `terminal-live-p' Because the function receives a `terminal' argument. > 2. maybe `terminal-live-p' needs to be changed to detect this condition I think there are 2 problems: 1- xterm-remove-modify-other-keys forgets to pass `terminal' to `send-string-to-terminal'. Hopefully, I've just fixed it, so that your recipe should not causes a segfault any more. 2- send-string-to-terminal causes a segfault is called for a terminal that is suspended. I've made it signal an error. Stefan From dann@mothra.ics.uci.edu Tue Sep 30 17:36:47 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-6.3 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 1052-done) by emacsbugs.donarmstrong.com; 1 Oct 2008 00:36:47 +0000 Received: from sallyv2.ics.uci.edu (sallyv2.ics.uci.edu [128.195.1.120]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m910ajV9016595 for <1052-done@emacsbugs.donarmstrong.com>; Tue, 30 Sep 2008 17:36:46 -0700 Received: from mothra.ics.uci.edu (mothra.ics.uci.edu [128.195.6.93]) by sallyv2.ics.uci.edu (8.13.7+Sun/8.13.7) with ESMTP id m910aNFv024183; Tue, 30 Sep 2008 17:36:27 -0700 (PDT) Received: (from dann@localhost) by mothra.ics.uci.edu (8.13.8+Sun/8.13.6/Submit) id m910aM6C018539; Tue, 30 Sep 2008 17:36:22 -0700 (PDT) Date: Tue, 30 Sep 2008 17:36:22 -0700 (PDT) Message-Id: <200810010036.m910aM6C018539@mothra.ics.uci.edu> From: Dan Nicolaescu To: Stefan Monnier Cc: 1052-done@debbugs.gnu.org, Chong Yidong Subject: Re: bug#1052: segfault when resuming emacsclient -t in an xterm References: <873ajho96t.fsf@cyd.mit.edu> <200809301818.m8UIIGFf003951@mothra.ics.uci.edu> In-Reply-To: (Stefan Monnier's message of "Tue, 30 Sep 2008 18:06:27 -0400") Lines: 11 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-ICS-MailScanner-Information: Please contact the ISP for more information X-ICS-MailScanner-ID: m910aNFv024183 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (score=-1.44, required 5, autolearn=disabled, ALL_TRUSTED -1.44) X-ICS-MailScanner-From: dann@mothra.ics.uci.edu Stefan Monnier writes: > I think there are 2 problems: > 1- xterm-remove-modify-other-keys forgets to pass `terminal' > to `send-string-to-terminal'. Hopefully, I've just fixed it, so that > your recipe should not causes a segfault any more. > > 2- send-string-to-terminal causes a segfault is called for a terminal > that is suspended. I've made it signal an error. Thank you, your changes seem to have fixed the problem. From unknown Sat Aug 16 15:57:19 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: $requester Subject: Internal Control Message-Id: bug archived. Date: Wed, 29 Oct 2008 14:24:03 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A log time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator