From owner-p4-projects@FreeBSD.ORG Sun Jun 29 12:36:12 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id EAB9E1065677; Sun, 29 Jun 2008 12:36:11 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93125106566C for ; Sun, 29 Jun 2008 12:36:11 +0000 (UTC) (envelope-from gabor@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 818798FC14 for ; Sun, 29 Jun 2008 12:36:11 +0000 (UTC) (envelope-from gabor@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m5TCaBIW035511 for ; Sun, 29 Jun 2008 12:36:11 GMT (envelope-from gabor@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m5TCaBoe035509 for perforce@freebsd.org; Sun, 29 Jun 2008 12:36:11 GMT (envelope-from gabor@freebsd.org) Date: Sun, 29 Jun 2008 12:36:11 GMT Message-Id: <200806291236.m5TCaBoe035509@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gabor@freebsd.org using -f From: Gabor Kovesdan To: Perforce Change Reviews Cc: Subject: PERFORCE change 144267 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jun 2008 12:36:12 -0000 http://perforce.freebsd.org/chv.cgi?CH=144267 Change 144267 by gabor@gabor_server on 2008/06/29 12:35:28 - Drop the GNU compatibility pre-editing workarounds. They don't work entirely and it is very weird to apply hacks in grep for our regex library. If we want better compatibility, the problem should be addressed there. A different behaviour in BSD grep than the behaviour of the base system regex library is clearly unwanted and I'm getting very frustrated of dealing with these weird workarounds. When I can make something compatible, compatibility breaks at another place. It wouldn't lead to anywhere. Affected files ... .. //depot/projects/soc2008/gabor_textproc/grep/Makefile#10 edit .. //depot/projects/soc2008/gabor_textproc/grep/grep.c#53 edit Differences ... ==== //depot/projects/soc2008/gabor_textproc/grep/Makefile#10 (text+ko) ==== @@ -31,8 +31,4 @@ CFLAGS+= -DWITHOUT_NLS .endif -.if defined(WITHOUT_GNU_COMPAT) -CFLAGS+= -DWITHOUT_GNU_COMPAT -.endif - .include ==== //depot/projects/soc2008/gabor_textproc/grep/grep.c#53 (text+ko) ==== @@ -202,92 +202,6 @@ static void add_pattern(char *pat, size_t len) { -#ifndef WITHOUT_GNU_COMPAT - char *ptr, *st; - int lbr, rbr; - -/* Workaround for our libc-regex library for better GNU compatibility. - Our library rejects some non-standard regular expressions, for example - '|' cannot stand with empty subexpressions. In these cases the - non-standard regex will be pre-edited, - e.g. "(|a|b||c|)" will be "(a|b|c)" */ - st = pat; - while (((ptr = strstr(st, "|)"))) != NULL) { - if (strstr(st, "\\|)") != (ptr - 1)) - strlcpy(ptr, &(ptr[1]), strlen(ptr)); - st = ptr; - } - st = pat; - while ((ptr = strstr(st, "(|")) != NULL) { - if ((strstr(st, "(\\|") != ptr) && (strstr(st, "\\(|") != (ptr - 1))) - strlcpy(&(ptr[1]), &(ptr[2]), strlen(ptr)); - st = ptr + 1; - } - st = pat; - while ((ptr = strstr(st, "||")) != NULL) { - if (strstr(st, "\\||") != (ptr - 1)) - strlcpy(&(ptr[1]), &(ptr[2]), strlen(ptr)); - st = ptr + 1; - } - st = pat; - while ((ptr = strstr(st, "*?")) != NULL) { - if (strstr(st, "\\*?") != (ptr - 1)) - strlcpy(&(ptr[1]), &(ptr[2]), strlen(ptr)); - st = ptr + 1; - } - st = pat; - while ((ptr = strstr(st, "?*")) != NULL) { - if (strstr(st, "\\?*") != (ptr - 1)) - strlcpy(&(ptr[1]), &(ptr[2]), strlen(ptr)); - st = ptr + 1; - } - st = pat; - while ((ptr = strstr(st, "**")) != NULL) { - if ((strstr(st, "\\**") != (ptr - 1)) && (strstr(st, "\\(**") != (ptr - 2))) - strlcpy(&(ptr[1]), &(ptr[2]), strlen(ptr)); - st = ptr + 1; - } - st = pat; - while ((ptr = strstr(st, "??")) != NULL) { - if (strstr(st, "\\??") != (ptr - 1)) - strlcpy(&(ptr[1]), &(ptr[2]), strlen(ptr)); - st = ptr + 1; - } - st = pat; - while ((ptr = strstr(st, "^*")) != NULL) { - strlcpy(&(ptr[1]), &(ptr[2]), strlen(ptr)); - st = ptr + 1; - } - st = pat; - while ((ptr = strstr(st, "(*")) != NULL) { - if (strstr(st, "\\(*") != (ptr - 1)) - strlcpy(&(ptr[1]), &(ptr[2]), strlen(ptr)); - st = ptr + 1; - } - st = pat; - if (Eflag) { - st = pat; - lbr = 0; - while ((ptr = strstr(st, "(")) != NULL) { - if (strstr(st, "\\(") != (ptr - 1)) - lbr++; - st = ptr + 1; - } - st = pat; - rbr = 0; - while ((ptr = strstr(st, ")")) != NULL) { - if (strstr(st, "\\)") != (ptr - 1)) - rbr++; - st = ptr + 1; - } - if (lbr != rbr) { - errx(2, getstr(8)); - } - } - while (pat[0] == '*') - pat++; -#endif - if (len == 0 || matchall) { matchall = 1; return;