From owner-freebsd-bugs@FreeBSD.ORG Fri Dec 17 21:30:11 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F1E0106567A for ; Fri, 17 Dec 2010 21:30:11 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id C2A1F8FC28 for ; Fri, 17 Dec 2010 21:30:10 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id oBHLUA26039685 for ; Fri, 17 Dec 2010 21:30:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id oBHLUApd039684; Fri, 17 Dec 2010 21:30:10 GMT (envelope-from gnats) Resent-Date: Fri, 17 Dec 2010 21:30:10 GMT Resent-Message-Id: <201012172130.oBHLUApd039684@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Pedro F. Giffuni" Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 310A1106564A for ; Fri, 17 Dec 2010 21:25:24 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (unknown [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 1F3F28FC13 for ; Fri, 17 Dec 2010 21:25:24 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id oBHLPN7I068103 for ; Fri, 17 Dec 2010 21:25:23 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id oBHLPNCV068102; Fri, 17 Dec 2010 21:25:23 GMT (envelope-from nobody) Message-Id: <201012172125.oBHLPNCV068102@red.freebsd.org> Date: Fri, 17 Dec 2010 21:25:23 GMT From: "Pedro F. Giffuni" To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/153257: libc/regex: Add support for \< and \> word delimiters X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Dec 2010 21:30:11 -0000 >Number: 153257 >Category: bin >Synopsis: libc/regex: Add support for \< and \> word delimiters >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Dec 17 21:30:10 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Pedro F. Giffuni >Release: 8.1-RELEASE >Organization: >Environment: FreeBSD mogwai.giffuni.net 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Tue Nov 9 10:31:43 UTC 2010 pedro@mogwai.giffuni.net:/usr/src/sys/i386/compile/GENERIC i386 >Description: As part as a sed port for Illumos, Garrett D'Amore has updated FreeBSD's regex from FreeBSD to include support for \< and \>, as these are historically in wide use on Solaris. This is in accordance to what gnu ans Solaris regex do. The diff was taken from here: https://www.illumos.org/issues/516 According to Garret's blog: http://gdamore.blogspot.com/2010/12/i-sed1-so.html (FreeBSD friends, please feel free to include these changes back -- I've not changed the original BSD license.) >How-To-Repeat: >Fix: Patch attached. Patch attached with submission follows: diff -ru regex.orig/regcomp.c regex/regcomp.c --- regex.orig/regcomp.c 2010-12-17 16:01:01.000000000 +0000 +++ regex/regcomp.c 2010-12-17 16:08:13.000000000 +0000 @@ -407,7 +407,17 @@ case '\\': (void)REQUIRE(MORE(), REG_EESCAPE); wc = WGETNEXT(); - ordinary(p, wc); + switch (wc) { + case '<': + EMIT(OBOW, 0); + break; + case '>': + EMIT(OEOW, 0); + break; + default: + ordinary(p, wc); + break; + } break; case '{': /* okay as ordinary except if digit follows */ (void)REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT); @@ -564,6 +574,12 @@ case '[': p_bracket(p); break; + case BACKSL|'<': + EMIT(OBOW, 0); + break; + case BACKSL|'>': + EMIT(OEOW, 0); + break; case BACKSL|'{': SETERROR(REG_BADRPT); break; >Release-Note: >Audit-Trail: >Unformatted: