fgrep / grep -F broken if WITH_BSD_GREP set in /etc/src.conf
in all cases return: literal expressions not supported at compile time.
Test: fgrep "mail" /etc/defaults/rc.conf
will fail with: literal expressions not supported at compile time
cflags |= REG_NOSPEC;
cflags |= REG_LITERAL;
errx(2, "literal expressions not supported at compile time");
Make buildworld broken/fail.
To fix system I copy grep from more old system and rebuild+reinstall world without WITH_BSD_GREP in /etc/src.conf.
(In reply to rozhuk.im from comment #0)
These commits shouldn't have made it into 11.1-RELEASE -- was this actually on stable/11? I'll be MFC'ing the fix for this soon.
(In reply to Kyle Evans from comment #1)
Some were after:
FreeBSD rimwks 11.1-STABLE FreeBSD 11.1-STABLE #0 r321762M: Mon Jul 31 13:17:27 MSK 2017
in the middle august.
A commit references this bug:
Date: Mon Sep 11 15:52:24 UTC 2017
New revision: 323443
bsdgrep: add a primitive literal matcher to unbreak fgrep in some scenarios
MFC r322825: bsdgrep: add some additional tests for fgrep
Previously added tests only check that fgrep is somewhat sane and works. Add
some more tests that check that the implementation is basically functional
and not producing incorrect results with various flags.
MFC r322826: bsdgrep: add a primitive literal matcher
fgrep/grep -F will error out at runtime if compiled with a regex(3)
that does not define REG_NOSPEC or REG_LITERAL. glibc is one such regex(3)
implementation, and as it turns out they don't support literal matching at
Provide a primitive literal matcher for use with glibc and other
implementations that don't support literal matching so that we don't
completely lose fgrep/grep -F if compiled against libgnuregex on stable/10,
stable/11, or other systems that we don't necessarily support.
This is a wholly unoptimized implementation with no plans to optimize it as
of now. This is due to both its use-case being primarily on unsupported
systems in the near-distant future and that it's reinventing the wheel that
we already have available as a feature of regex(3).
Approved by: emaste (mentor, blanket MFC)