unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* etags segfault
@ 2003-08-26  1:18 Tak Ota
  0 siblings, 0 replies; 5+ messages in thread
From: Tak Ota @ 2003-08-26  1:18 UTC (permalink / raw)


Without the following patch etags causes a segmentation fault.

-Tak


ota@tak-4100 /cygdrive/d/pub/emacs/emacs-21.3.50/lib-src
$ diff -c ../../pure/emacs-21.3.50/lib-src/etags.c etags.c
*** ../../pure/emacs-21.3.50/lib-src/etags.c	Tue Jul 29 07:39:03 2003
--- etags.c	Mon Aug 25 18:02:34 2003
***************
*** 3116,3122 ****
  	      fvdef = vignore;
  	      return FALSE;
  	    }
! 	  if (strneq (str+len-10, "::operator", 10))
  	    {
  	      if (*c_extp & C_AUTO) /* automatic detection of C++ */
  		*c_extp = (*c_extp | C_PLPL) & ~C_AUTO;
--- 3116,3122 ----
  	      fvdef = vignore;
  	      return FALSE;
  	    }
! 	  if (len-10 > 0 && strneq (str+len-10, "::operator", 10))
  	    {
  	      if (*c_extp & C_AUTO) /* automatic detection of C++ */
  		*c_extp = (*c_extp | C_PLPL) & ~C_AUTO;

ota@tak-4100 /cygdrive/d/pub/emacs/emacs-21.3.50/lib-src
$ diff -c ../../pure/emacs-21.3.50/lib-src/ChangeLog ChangeLog
*** ../../pure/emacs-21.3.50/lib-src/ChangeLog	Fri Aug 22 06:37:32 2003
--- ChangeLog	Mon Aug 25 18:15:05 2003
***************
*** 1,3 ****
--- 1,8 ----
+ 2003-08-25  Takaaki Ota  <Takaaki.Ota@am.sony.com>
+ 
+ 	* etags.c (consider_token): check C++ `operator' only when the
+ 	token len is long enough.
+ 
  2003-08-20  Dave Love  <fx@gnu.org>
  
  	* Makefile.in: Remove obsolete references to alloca.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* etags segfault
@ 2008-08-22  1:30 Kenichi Handa
  2008-08-25  7:56 ` Francesco Potorti`
  0 siblings, 1 reply; 5+ messages in thread
From: Kenichi Handa @ 2008-08-22  1:30 UTC (permalink / raw)
  To: emacs-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=ISO-2022-JP-2, Size: 813 bytes --]

Latest CVS Emacs has a bug in lib-src/etags.

% cd emacs/src
% make tags
../lib-src/etags --include=TAGS-LISP --include=../lwlib//TAGS --regex='/[ 	]*DEFVAR_[A-Z_ 	(]+"\([^"]+\)"/' /usr/local/work/emacs/src/[xyzXYZ]*.[hc] /usr/local/work/emacs/src/[a-wA-W]*.[hc]
make: *** [TAGS] Segmentation fault

The seqfault occurs on GNU/Linux at this line (the last line
of the function incanonicalize_filename):

  *fn = '\0';

I suspect this change introduced this bug.

2008-08-17  Francesco Potort^[$(D+@^[(B  <pot@gnu.org>

	* etags.c (main): Use canonicalize_filename on tags file name.
	(relative_filename): Revert 3.85: do not collapse slashes here.
	(absolute_dirname): Remove useless call to canonicalize_filename.
	(canonicalize_filename): Collapse multiple slashes here.

---
Kenichi Handa
handa@ni.aist.go.jp




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: etags segfault
  2008-08-22  1:30 etags segfault Kenichi Handa
@ 2008-08-25  7:56 ` Francesco Potorti`
  2008-08-25 11:49   ` Kenichi Handa
  2008-08-26  1:58   ` Bob Rogers
  0 siblings, 2 replies; 5+ messages in thread
From: Francesco Potorti` @ 2008-08-25  7:56 UTC (permalink / raw)
  To: Kenichi Handa, Bob Rogers; +Cc: emacs-devel

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
>      {




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: etags segfault
  2008-08-25  7:56 ` Francesco Potorti`
@ 2008-08-25 11:49   ` Kenichi Handa
  2008-08-26  1:58   ` Bob Rogers
  1 sibling, 0 replies; 5+ messages in thread
From: Kenichi Handa @ 2008-08-25 11:49 UTC (permalink / raw)
  To: Francesco Potorti`; +Cc: rogers-emacs, emacs-devel

In article <E1KXWwK-0008PL-4n@tucano.isti.cnr.it>, Francesco Potorti` <pot@gnu.org> writes:

> 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.

Thank you.  I confirmed the fix.

---
Kenichi Handa
handa@ni.aist.go.jp




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: etags segfault
  2008-08-25  7:56 ` Francesco Potorti`
  2008-08-25 11:49   ` Kenichi Handa
@ 2008-08-26  1:58   ` Bob Rogers
  1 sibling, 0 replies; 5+ messages in thread
From: Bob Rogers @ 2008-08-26  1:58 UTC (permalink / raw)
  To: Francesco Potorti`; +Cc: emacs-devel, Kenichi Handa

   From: Francesco Potorti` <pot@gnu.org>
   Date: Mon, 25 Aug 2008 09:56:40 +0200

   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.

Good point; thank you for catching that.

					-- Bob




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-08-26  1:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-22  1:30 etags segfault Kenichi Handa
2008-08-25  7:56 ` Francesco Potorti`
2008-08-25 11:49   ` Kenichi Handa
2008-08-26  1:58   ` Bob Rogers
  -- strict thread matches above, loose matches on Subject: below --
2003-08-26  1:18 Tak Ota

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).