Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 02 Apr 2007 14:38:25 +0200
From:      Stan Behrens <s.behrens@kon.de>
To:        freebsd-bugs@freebsd.org
Subject:   6.2-STABLE / grep / Segmentation fault
Message-ID:  <4610F941.3080009@kon.de>

next in thread | raw e-mail | index | archive | help
Hi,

This silly script brings grep into trouble, please don't ask why I do this that way (and yes, I know here-docs ...):

<<<SSSCCCRRRIIIPPPTTT>>>
#!/bin/sh

extract () {
         grep -m 1 -A 99 '^//START '$1'$' $0 | \
	grep -m 1 -B 99 '^//STOP '$1'$' | \
	grep -v '^//\(START\|STOP\) '$1'$'
}

extract /etc/rc.local >rc.local
extract /etc/rc.conf >rc.conf
exit

//START /etc/rc.local
hier config fuer neues system
da auch config fuer neues system
//STOP /etc/rc.local

//START /etc/rc.conf
hostname="blub.hausen"
//STOP /etc/rc.conf
<<<///SSSCCCRRRIIIPPPTTT>>>

Here is the backtrace:

<<<GGGDDDBBB>>>
(gdb) bt
#0  0x0804de4d in dfaexec (d=0x8059a80,
     begin=0x8063141 "//START /etc/rc.conf\nhostname=\"blub.hausen\"\n//STOP /etc/rc.conf\n", size=4160343744, backref=0xbfbfe690) at dfa.c:2854
#1  0x08053a1e in EGexecute (
     buf=0x8063141 "//START /etc/rc.conf\nhostname=\"blub.hausen\"\n//STOP /etc/rc.conf\n", size=20, match_size=0x1, exact=0) at search.c:430
#2  0x0804f8f0 in prpending (lim=0x8063181 "") at grep.c:672
#3  0x08050366 in grepfile (file=0xbfbfea74 "blub.sh", stats=0x80596c0)
     at grep.c:887
#4  0x080514d7 in main (argc=7, argv=0xbfbfe950) at grep.c:1850
<<<///GGGDDDBBB>>>

I hope I could help, Bye.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4610F941.3080009>