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.
PR: 184733, 191086
Differential D10114
Switch to WITH_GNU_GREP_COMPAT knob instead of WITHOUT_GNU_GREP_COMPAT kevans on Mar 23 2017, 4:14 AM. Authored by Tags None Referenced Files
Details
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. PR: 184733, 191086 Run the kyua tests to ensure we've not caused any regressions
Diff Detail
Event TimelineComment Actions I think this is a reasonable change to make. It'd be good to have a list of what the "gnu extensions" are for the commit message, and perhaps to be mentioned in the WITH_GNU_GREP_COMPAT file though. Comment Actions PR191086: GNU grep and WITH_GNU_GREP_COMPAT bsdgrep do not accept [[:<:]] and [[:>:]] character classes.
Comment Actions Heh, shucks. =) I'm not familiar with the GNU extensions myself outside of knowing that the mentioned PRs exhibited broken behavior with libgnuregex and was fine without -- it'll take me a little bit to scrape through our version of libgnuregex and make somewhat of an exhaustive list of differences.
Comment Actions I can't imagine many ports want to use /usr/bin/bsdgrep and not grep, and switching BSD grep to be installed as /usr/bin/grep really needs an exp-run. I suspect we should perform the exp-run with: diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 16c2527de51f..afc4a51e8e24 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -62,6 +62,7 @@ __DEFAULT_YES_OPTIONS = \ BOOTPARAMD \ BOOTPD \ BSD_CPIO \ + BSD_GREP \ BSDINSTALL \ BSNMP \ BZIP2 \ @@ -99,8 +100,6 @@ __DEFAULT_YES_OPTIONS = \ GDB \ GNU \ GNU_DIFF \ - GNU_GREP \ - GNU_GREP_COMPAT \ GPIO \ GPL_DTC \ GROFF \ @@ -179,9 +180,10 @@ __DEFAULT_YES_OPTIONS = \ ZONEINFO __DEFAULT_NO_OPTIONS = \ - BSD_GREP \ CLANG_EXTRAS \ DTRACE_TESTS \ + GNU_GREP \ + GNU_GREP_COMPAT \ HESIOD \ LIBSOFT \ NAND \
Comment Actions Ahhh, excellent! I had no idea that mdoc(7) was a thing, and I was just starting to worry about making man changes without a document similar to style(9) that I can reference. This looks to be exactly what I needed, though. Thanks!
Comment Actions According to http://www.regular-expressions.info, GNU extensions:
Additionally, I've noted that GNU utilities seem to allow patterns like "a{,}" or "a{,5}" to mean "any number of a" or "up to 5 a" respectively, rather than the format described by re_format(7) where the start of the interval at least must be specified, while the end may be omitted. I could slowly implement some of these into regex(3) if that is deemed desirable, whether it be through some kind of additional flag or #define support. |