Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!oddjob!mimsy!cvl!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: comp.bugs.4bsd,comp.bugs.sys5 Subject: Re: egrep botch Message-ID: <7518@elsie.UUCP> Date: Fri, 23-Oct-87 16:47:23 EST Article-I.D.: elsie.7518 Posted: Fri Oct 23 16:47:23 1987 Date-Received: Sun, 25-Oct-87 18:17:09 EST References: <8759@utzoo.UUCP> Organization: NIH-LEC, Bethesda, MD Lines: 40 Summary: Ambition should be made of Sterno stuff Xref: mnetor comp.bugs.4bsd:603 comp.bugs.sys5:265 > The following bug appears to be present in egrep (the Bell/AT&T one, not > the comp.sources.unix one) on all extant versions of Unix. Certainly it > is present in V7, 4.2BSD, Sunnix 3.2, and 386 System V Release 3. > > % echo 0 >foo > % egrep '0.' foo > % egrep '^0.' foo > 0 > % > > Adding the "^" seems to convince egrep that "." can legitimately match > newline. Changing "." to "[^x]" does not change the behavior. Some quick > tests suggest that "$" does not produce a similar anomaly. The change below cures the problem, and even "looks right." Your line numbers will vary. *** 3.2/egrep.y Fri Oct 23 16:34:20 1987 --- 3.3/egrep.y Fri Oct 23 16:34:24 1987 *************** *** 303,309 **** if ((k = name[curpos]) >= 0) if ( (k == c) ! | (k == DOT) | (k == CCL && member(c, right[curpos], 1)) | (k == NCCL && member(c, right[curpos], 0)) ) { --- 303,309 ---- if ((k = name[curpos]) >= 0) if ( (k == c) ! | (k == DOT && c != '\n') | (k == CCL && member(c, right[curpos], 1)) | (k == NCCL && member(c, right[curpos], 0)) ) { -- Bugs is a trademark of Warner Brothers and Volkswagen. -- ado@vax2.nlm.nih.gov ADO, VAX, and NIH are trademarks of Ampex and DEC.