grep: add proper support for pattern_list
authorSören Tempel <soeren+git@soeren-tempel.net>
Mon, 30 Mar 2020 09:02:08 +0000 (11:02 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 29 Apr 2020 22:20:18 +0000 (00:20 +0200)
commit42a8984abc5eed709addac263aab43d64d47257d
tree94ca67b5972f991b805073ed6aefbac23b36b96c
parentc3295d233b6a7d924814eec9a5c5999a876daf9e
grep: add proper support for pattern_list

From POSIX.1-2008:

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

As such, given patterns need to be split at newline characters. Without
doing so, busybox grep will interpret the newline as part of the pattern
which is not in accordance with POSIX.

See also: https://bugs.busybox.net/show_bug.cgi?id=12721

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
findutils/grep.c
testsuite/grep.tests