grep requires uses tests during the configure phase requiring grep to work. In case of an nonfunctional grep (p.ex. after a libpcre update destroying shared library linking) it's not possible to rebuild grep without itself. It could be replaced temporarily with busybox if available. grep contains a Makefile.boot which is designed for that, but requires a handmade config.h to build and seems not very viable. An option to bootstrap grep without grep (with a hacky perl script to emulate grep or something like that) or a bin version would be nice. Reproducible: Always Steps to Reproduce: 1. remove grep 2. emerge sys-apps/grep
It has been this way for years, regardless it is an upstream issue not a Gentoo Linux issue.
config.h doesn't seem to be the big issue, it's the bundled gnulib code. feel free to hassle upstream grep about it, but we won't bother trying to fix this ourselves. you can workaround the issue locally by doing: sudo ln -s /bin/busybox /bin/grep