[BusyBox] Re: [patch] Simplify the heck out of the sed newline hack.

Rob Landley rob at landley.net
Fri Sep 26 03:48:18 UTC 2003


On Thursday 25 September 2003 20:34, Glenn McGrath wrote:
> On Thu, 25 Sep 2003 15:26:59 -0500
>
> Rob Landley <rob at landley.net> wrote:
> > Here's a test program to show that glibc regex is matching patterns
> > containing newlines just fine.  (I haven't tested uclibc regex, but if
> > it doesn't work and glibc does, that's a bug and I'll fix it.)
> >
> > int main(int argc, char *argv[])
> > {
> >   regex_t regex;
> >   regmatch_t match;
> > //  char grepstr[]="fred[123]ish";
> > //  char *string="abcfred2ishdef";
> >   char *grepstr="oom\nping";
> >   char *string="thingoom\npingb";
> >
> >   printf("%d\n",regcomp(&regex, grepstr, REG_NEWLINE));
> >   printf("%d\n",regexec(&regex,string,1,&match,0));
> >   printf("%d %d\n",match.rm_so,match.rm_eo);
> > }
>
> Interesting, its definetly a bug in sed.c then, and the current newline
> hack is the wrong approach.
>
>
> Glenn

I'm banging on it.

I started reading the spec again from the beginning, which resulted in me 
writing up a list of tests, which resulted in me writing sedtests.py, which 
is a little python script that runs sed tests.  Here's what I have so far...

I've ripped out the newline hack entirely in my tree, and I've got a test for 
newline behavior.  Right now I'm getting test cases from the spec, and late 
(since I have to re-read a lot of the code anyway) I hope to get test cases 
from the code.  THEN, I intend to get test cases from the binutils build, and 
from previous emails you've sent me.

I just changed a lot of code (simplying the heck out of the big sedding loop), 
and I'll just about guarantee you I broke something.  Time for a regression 
test harness, then. :)

Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sedtests.py
Type: text/x-python
Size: 2857 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20030925/e02daad1/attachment.py 


More information about the busybox mailing list