From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Casper Gripenberg Newsgroups: gmane.emacs.bugs Subject: Crash in tparam.c on OpenBSD Date: Fri, 2 Jan 2004 00:54:31 +0200 Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <20040101225431.GA8055@zoidberg.homeip.net> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1072997789 32442 80.91.224.253 (1 Jan 2004 22:56:29 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 1 Jan 2004 22:56:29 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jan 01 23:56:26 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AcBju-0000G9-00 for ; Thu, 01 Jan 2004 23:56:26 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AcCgM-0000sQ-7d for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Jan 2004 18:56:50 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AcCg7-0000qI-KT for bug-gnu-emacs@gnu.org; Thu, 01 Jan 2004 18:56:35 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AcCfa-0000mK-Pz for bug-gnu-emacs@gnu.org; Thu, 01 Jan 2004 18:56:33 -0500 Original-Received: from [193.185.137.18] (helo=zoidberg.homeip.net) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.24) id 1AcCfa-0000lw-AD for bug-gnu-emacs@gnu.org; Thu, 01 Jan 2004 18:56:02 -0500 Original-Received: from zoidberg.homeip.net (casper@localhost [127.0.0.1]) by zoidberg.homeip.net (8.12.9/8.12.9) with ESMTP id i01MsW2a029925 for ; Fri, 2 Jan 2004 00:54:32 +0200 (EET) Original-Received: (from casper@localhost) by zoidberg.homeip.net (8.12.9/8.12.9/Submit) id i01MsWPt022183 for bug-gnu-emacs@gnu.org; Fri, 2 Jan 2004 00:54:32 +0200 (EET) Original-To: bug-gnu-emacs@gnu.org Content-Disposition: inline User-Agent: Mutt/1.5.4i X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list 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 Xref: main.gmane.org gmane.emacs.bugs:6447 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:6447 Hi, I'm running OBSD 3.3 with a recently compiled GNU Emacs 21.3.1 (i386-unknown-openbsd3.3, X toolkit, Xaw3d scroll bars). This is compiled straight from the original emacs source: > ls ... 20399831 Mar 19 2003 emacs-21.3.tar.gz Emacs works fine, except if I happen to run emacs with TERM set, but not TERMCAP set. This situation arises when I run emacs with sudo, as sudo cleans out the TERMCAP variable for security reasons (yeah I know..what security, when emacs is run as root..but that's beside the point :)). When I run without TERMCAP (manually unset TERMCAP or through sudo) emacs will dump core when there is anything it is about to highlite. I.e. if I do an i-search and emacs finds a match then BOOM..instant core. If I set TERM to vt100 then it seems to work OK, but for example TERM=linux or xterm-xfree86 and I get the crash. When I gdb the core I see an abort() call being made in tparam.c on line 298: case 'D': /* %D means weird Delta Data transformation. */ argp[0] -= 2 * (tem % 16); break; default: > abort (); } } The reason for the abort call is in the arguments to the method tparam1: (gdb) up #1 0x86ec8 in fatal_error_signal (sig=6) at emacs.c:354 (gdb) up #2 0x4015f004 in ?? () (gdb) up #3 0x123bd5 in tparam1 (string=0x49b105 "\e[3%p1%dm", outstring=0x5904c0 "\e[3", len=0, up=0x0, left=0x0, argp=0xcfbfc088) at tparam.c:298 (gdb) See the string "\e[3%p1%dm". This string conains %p, which seems to me is not recognized by the parsing algorithm in tparam1(). Hence the abort() call. Now going up two levels we get here: (gdb) up #4 0x123709 in tparam (string=0x49b105 "\e[3%p1%dm", outstring=0x0, len=0, arg0=6, arg1=2496000, arg2=1, arg3=8) at tparam.c:105 (gdb) up #5 0x4b3a9 in turn_on_face (f=0x261600, face_id=11) at term.c:2107 (gdb) Which looks like this: if (fg >= 0 && TS_set_foreground) { > p = tparam (TS_set_foreground, NULL, 0, (int) fg); OUTPUT (p); xfree (p); } Where TS_set_foreground is the "\e[3%p1%dm" string. I have no idea what all this means, or what the tparam method does, or anything about TERMCAP...so I'm not going to draw any conclusions :) But it makes me interested..where does the %p come from, and why does emacs not know what to do with it (should it know? probaby not?). I put the termcap as well as the full 'gdb where' here: http://zoidberg.homeip.net/emacsbug/ Regards, Casper