grep: Fix -f FILE when FILE is empty and -x provided

Grep currently special-cased empty pattern file to be the same as
pattern file with one empty line (empty pattern). That does mirror how
GNU grep behaves, except when -x is provided. In that case .* pattern
needs to be used instead.

Signed-off-by: Gray Wolf <>
Signed-off-by: Denys Vlasenko <>
2 files changed