Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!umd5!cvl!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: comp.bugs.4bsd,comp.bugs.sys5 Subject: Re: egrep botch Message-ID: <7524@elsie.UUCP> Date: Sun, 8-Nov-87 16:59:11 EST Article-I.D.: elsie.7524 Posted: Sun Nov 8 16:59:11 1987 Date-Received: Wed, 11-Nov-87 02:47:14 EST References: <8759@utzoo.UUCP> <7518@elsie.UUCP> <8872@utzoo.UUCP> Organization: NIH-LEC, Bethesda, MD Lines: 31 Summary: Completing the fix Xref: mnetor comp.bugs.4bsd:619 comp.bugs.sys5:289 In article <8872@utzoo.UUCP>, henry@utzoo.UUCP (Henry Spencer) writes: > > The change. . .cures the problem, and even "looks right." > > Unfortunately, it doesn't cure the whole problem, since changing "." to > "[^x]" still provokes the bug. True enough. Newline shouldn't match "."; it also shouldn't match "[anything]" or "[^anything]". This can be reflected by moving the test against newline (converting "|" operators into "||" in the process as an efficiency boost). Here's the diff against the "original" egrep.y. As always, the trade secret status of the code involved precludes a clearer posting. 304,308c304,311 < if ( < (k == c) < | (k == DOT) < | (k == CCL && member(c, right[curpos], 1)) < | (k == NCCL && member(c, right[curpos], 0)) --- > if ( > k == c || > (c != '\n' && > (k == DOT || > (k == CCL && > member(c, right[curpos], 1)) || > (k == NCCL && > member(c, right[curpos], 0)))) -- ado@vax2.nlm.nih.gov ADO, VAX, and NIH are trademarks of Ampex and DEC.