unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [RFC] etags ada parser: doesn't stop when giving broken input
@ 2013-04-08  8:18 Masatake YAMATO
  2013-04-09  9:00 ` Stephen Leake
  0 siblings, 1 reply; 4+ messages in thread
From: Masatake YAMATO @ 2013-04-08  8:18 UTC (permalink / raw)
  To: emacs-devel

Look at following bug reproducer:

    % cat /tmp/a.adb
    cat /tmp/a.adb
    ~

    # Make TAGS file with the original version
    % /usr/bin/etags /tmp/a.adb 
    /usr/bin/etags /tmp/a.adb 
    #  Doen't stop C-c C-c^C

    # Patched version
    % ./etags /tmp/a.adb 
    ./etags /tmp/a.adb 
    % LC_ALL=C ls -l TAGS
    -rw-rw-r--. 1 yamato yamato 15 Apr  8 17:09 TAGS

I expect etags stops even if broken input is given.
I wrote a small patch. However, I'm not sure this is correct fix.
Someone who knows both ada and etags, could you review this patch?

    
2013-04-08  Masatake YAMATO  <yamato@redhat.com>

	* etags.c (Ada_funcs): Advance dbp before checking
	input with endtoken.

=== modified file 'lib-src/etags.c'
*** lib-src/etags.c	2013-03-13 07:27:34 +0000
--- lib-src/etags.c	2013-04-08 08:06:37 +0000
***************
*** 4231,4238 ****
  	    }
  
  	  /* Look for the end of the token. */
! 	  while (!endtoken (*dbp))
  	    dbp++;
  
  	} /* advance char */
      } /* advance line */
--- 4231,4239 ----
  	    }
  
  	  /* Look for the end of the token. */
! 	  do
  	    dbp++;
+ 	  while (!endtoken (*dbp));
  
  	} /* advance char */
      } /* advance line */




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

* Re: [RFC] etags ada parser: doesn't stop when giving broken input
  2013-04-08  8:18 [RFC] etags ada parser: doesn't stop when giving broken input Masatake YAMATO
@ 2013-04-09  9:00 ` Stephen Leake
  2013-04-09 21:05   ` Francesco Potortì
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Leake @ 2013-04-09  9:00 UTC (permalink / raw)
  To: emacs-devel

Masatake YAMATO <yamato@redhat.com> writes:

> I expect etags stops even if broken input is given.

That's certainly reasonable

> I wrote a small patch. However, I'm not sure this is correct fix.
> Someone who knows both ada and etags, could you review this patch?

I know Ada, but not etags. 

Your fix is not particular to Ada; it makes sense for any "token". It
looks reasonable to me, but I did not read the entire function (only the
patch). 

Is there a test suite for etags.c? I could contribute some Ada code, if
needed. 

-- 
-- Stephe



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

* Re: [RFC] etags ada parser: doesn't stop when giving broken input
  2013-04-09  9:00 ` Stephen Leake
@ 2013-04-09 21:05   ` Francesco Potortì
  2013-04-10  0:36     ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Francesco Potortì @ 2013-04-09 21:05 UTC (permalink / raw)
  To: Stephen Leake; +Cc: emacs-devel

>Is there a test suite for etags.c? I could contribute some Ada code, if
>needed. 

I have one.  I am out on a business trip.  Please remind me next week
and I will try to pack it ans send it to whover want sis it with instructions.



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

* Re: [RFC] etags ada parser: doesn't stop when giving broken input
  2013-04-09 21:05   ` Francesco Potortì
@ 2013-04-10  0:36     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2013-04-10  0:36 UTC (permalink / raw)
  To: Francesco Potortì; +Cc: Stephen Leake, emacs-devel

> I have one.  I am out on a business trip.  Please remind me next week
> and I will try to pack it ans send it to whover want sis it
> with instructions.

Please add it to emacs/test somewhere.

It's better to put there tests in "raw form" (without scripts
surrounding them to run them conveniently) than to not have them at all.
Of course, it's even better if they come with nice scripts to run them.


        Stefan



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

end of thread, other threads:[~2013-04-10  0:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-08  8:18 [RFC] etags ada parser: doesn't stop when giving broken input Masatake YAMATO
2013-04-09  9:00 ` Stephen Leake
2013-04-09 21:05   ` Francesco Potortì
2013-04-10  0:36     ` Stefan Monnier

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