Bug 12721 - grep does not implement -e pattern_lists currently
Summary: grep does not implement -e pattern_lists currently
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.31.x
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-29 21:54 UTC by Hans Acker
Modified: 2020-04-30 14:20 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hans Acker 2020-03-29 21:54:18 UTC
From `grep(1p)`:

  The pattern_list's value shall consist of one or more patterns separated by <newline> characters;

Consider the following invocation:

  printf "foo\nbar\nbaz\n" | grep -Fv -e "$(printf "foo\nbar\n")"

In accordance with the POSIX man page this should output the following:

  baz

This is what GNU grep (for instance) outputs. The busybox implementation outputs:

  foo
  bar
  baz

Instead. Looking at the implementation this is due to the fact that busybox does not check for newline in patterns when the -e option is given.
Comment 1 Denys Vlasenko 2020-04-30 14:20:50 UTC
Fixed in git