bsdgrep: disable GNU_GREP_COMPAT by default

The GNU extension bits in the base system are old, no longer faithful
to upstream, and surprising in some regards. Switch to documenting
WITH_GNU_GREP_COMPAT and default GNU_GREP_COMPAT to OFF in the name of
good behavior.

According to http://www.regular-expressions.info, GNU extensions:

-  Add missing quantifiers to BREs: \?, \+

-  Add branching to BREs: \|

-  Add backreferences (\1 through \9) to EREs

-  Add \w, \W, \s, and \S corresponding to :alnum:, [^[:alnum:]],
   :space:, and [^[:space:]] respectively

-  Add word boundaries and anchors:
   \b: word boundary
   \B: not word boundary
   \<: Strt of word
   \>: End of word
   \`: Start of subject string
    \': End of subject string

These extensions are still available in /usr/bin/grep by default today,
as it is still GNU grep.  As part of the bsdgrep migration plan these
extensions may be added to bsdgrep's regex support if necessary.

Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D10114
This commit is contained in:
Ed Maste 2017-04-21 14:50:29 +00:00
parent 3f39ffc893
commit e9e768f7e3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=317255
3 changed files with 9 additions and 4 deletions

View File

@ -732,9 +732,10 @@ and
.It Va WITHOUT_GNU_GREP
Set to not build GNU
.Xr grep 1 .
.It Va WITHOUT_GNU_GREP_COMPAT
Set this option to omit the gnu extensions to grep from being included in
BSD grep.
.It Va WITH_GNU_GREP_COMPAT
Set this option to include GNU extensions in
.Xr bsdgrep 1
by linking against libgnuregex.
.It Va WITHOUT_GPIO
Set to not build
.Xr gpioctl 8

View File

@ -99,7 +99,6 @@ __DEFAULT_YES_OPTIONS = \
GCOV \
GNU_DIFF \
GNU_GREP \
GNU_GREP_COMPAT \
GPIO \
GPL_DTC \
GROFF \
@ -181,6 +180,7 @@ __DEFAULT_NO_OPTIONS = \
BSD_GREP \
CLANG_EXTRAS \
DTRACE_TESTS \
GNU_GREP_COMPAT \
HESIOD \
LIBSOFT \
NAND \

View File

@ -0,0 +1,4 @@
.\" $FreeBSD$
Set this option to include GNU extensions in
.Xr bsdgrep 1
by linking against libgnuregex.