|Summary:||fgrep / grep -F broken if WITH_BSD_GREP set|
|Component:||bin||Assignee:||Kyle Evans <kevans>|
|Severity:||Affects Many People||CC:||kevans, rozhuk.im|
Description rozhuk.im 2017-09-10 17:54:17 UTC
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 /usr/src/usr.bin/grep/grep.c: case GREP_FIXED: #if defined(REG_NOSPEC) cflags |= REG_NOSPEC; #elif defined(REG_LITERAL) cflags |= REG_LITERAL; #else errx(2, "literal expressions not supported at compile time"); #endif break; 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.
Comment 1 Kyle Evans 2017-09-11 13:24:47 UTC
(In reply to rozhuk.im from comment #0) Hi, 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.
Comment 2 rozhuk.im 2017-09-11 15:37:15 UTC
(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.
Comment 3 commit-hook 2017-09-11 15:52:47 UTC
A commit references this bug: Author: kevans Date: Mon Sep 11 15:52:24 UTC 2017 New revision: 323443 URL: https://svnweb.freebsd.org/changeset/base/323443 Log: 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 all. 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). PR: 222201 Approved by: emaste (mentor, blanket MFC) Changes: _U stable/11/ stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh stable/11/usr.bin/grep/grep.c stable/11/usr.bin/grep/grep.h stable/11/usr.bin/grep/util.c
Comment 4 rozhuk.im 2017-09-13 10:50:58 UTC
Ok, fixed. Thanks!