From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Francesco Potorti` Newsgroups: gmane.emacs.devel Subject: Re: etags segfault Date: Mon, 25 Aug 2008 09:56:40 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1219651067 10166 80.91.229.12 (25 Aug 2008 07:57:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Aug 2008 07:57:47 +0000 (UTC) Cc: emacs-devel@gnu.org To: Kenichi Handa , Bob Rogers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 25 09:58:40 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KXWyF-0007fq-VD for ged-emacs-devel@m.gmane.org; Mon, 25 Aug 2008 09:58:40 +0200 Original-Received: from localhost ([127.0.0.1]:45695 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KXWxI-0006Kf-5j for ged-emacs-devel@m.gmane.org; Mon, 25 Aug 2008 03:57:40 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KXWxD-0006I9-OH for emacs-devel@gnu.org; Mon, 25 Aug 2008 03:57:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KXWxB-0006Fy-MD for emacs-devel@gnu.org; Mon, 25 Aug 2008 03:57:35 -0400 Original-Received: from [199.232.76.173] (port=60937 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KXWxB-0006FX-Dt for emacs-devel@gnu.org; Mon, 25 Aug 2008 03:57:33 -0400 Original-Received: from mx4.isti.cnr.it ([194.119.192.6]:50119 helo=ITANIUM.ISTI.CNR.IT) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KXWxA-000888-Qe for emacs-devel@gnu.org; Mon, 25 Aug 2008 03:57:33 -0400 Original-Received: from conversionlocal.isti.cnr.it by mx.isti.cnr.it (PMDF V6.4-beta #31598) id <01MYRSBUVYJ49M3W26@mx.isti.cnr.it> for emacs-devel@gnu.org; Mon, 25 Aug 2008 09:56:41 +0200 Original-Received: from tucano.isti.cnr.it (tucano.isti.cnr.it [146.48.81.102]) by mx.isti.cnr.it (PMDF V6.4-beta #31599) with ESMTPSA id <01MYRSBUK8HW9N6AHP@mx.isti.cnr.it>; Mon, 25 Aug 2008 09:56:40 +0200 Original-Received: from pot by tucano.isti.cnr.it with local (Exim 4.69) (envelope-from ) id 1KXWwK-0008PL-4n; Mon, 25 Aug 2008 09:56:40 +0200 In-reply-to: X-INSM-ip-source: 146.48.81.102 Auth Done X-fingerprint: 4B02 6187 5C03 D6B1 2E31 7666 09DF 2DC9 BE21 6115 X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:102926 Archived-At: I fixed etags' segfault on the trunk. Sorry, my regression tests did not cover this case. The cure is simply to allocate space in memory rather than using static strings. I did not use the patch below, because if leaves tagfiledir uninitialised in the first case. >Index: lib-src/etags.c >=================================================================== >RCS file: /sources/emacs/emacs/lib-src/etags.c,v >retrieving revision 3.89 >diff -c -r3.89 etags.c >*** lib-src/etags.c 16 Aug 2008 23:57:41 -0000 3.89 >--- lib-src/etags.c 23 Aug 2008 20:03:06 -0000 >*************** >*** 1250,1257 **** > /* NOTREACHED */ > } > >- if (tagfile == NULL) >- tagfile = CTAGS ? "tags" : "TAGS"; > cwd = etags_getcwd (); /* the current working directory */ > if (cwd[strlen (cwd) - 1] != '/') > { >--- 1250,1255 ---- >*************** >*** 1260,1267 **** > free (oldcwd); > } > /* Relative file names are made relative to the current directory. */ >! if (streq (tagfile, "-") >! || strneq (tagfile, "/dev/", 5)) > tagfiledir = cwd; > else > { >--- 1258,1267 ---- > free (oldcwd); > } > /* Relative file names are made relative to the current directory. */ >! if (tagfile == NULL) >! tagfile = CTAGS ? "tags" : "TAGS"; >! else if (streq (tagfile, "-") >! || strneq (tagfile, "/dev/", 5)) > tagfiledir = cwd; > else > {