diff options
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | src/grep.c | 2 | ||||
-rwxr-xr-x | tests/binary-file-matches | 8 |
3 files changed, 11 insertions, 4 deletions
@@ -11,6 +11,11 @@ GNU grep NEWS -*- outline -*- release 2.5.3 (2007), now warn that they are obsolescent and should be replaced by grep -E and grep -F. +** Bug fixes + + The -s option no longer suppresses "binary file matches" messages. + [Bug#51860 introduced in grep 3.5] + * Noteworthy changes in release 3.7 (2021-08-14) [stable] @@ -1646,7 +1646,7 @@ grep (int fd, struct stat const *st, bool *ineof) finish_grep: done_on_match = done_on_match_0; out_quiet = out_quiet_0; - if (binary_files == BINARY_BINARY_FILES && ! (out_quiet | suppress_errors) + if (binary_files == BINARY_BINARY_FILES && !out_quiet && (encoding_error_output || (0 <= nlines_first_null && nlines_first_null < nlines))) error (0, 0, _("%s: binary file matches"), input_filename ()); diff --git a/tests/binary-file-matches b/tests/binary-file-matches index 7fc4a11a..8fea071f 100755 --- a/tests/binary-file-matches +++ b/tests/binary-file-matches @@ -14,8 +14,10 @@ fail=0 echo "grep: (standard input): binary file matches" > exp \ || framework_failure_ -printf 'a\0' | grep a > out 2> err || fail=1 -compare /dev/null out || fail=1 -compare exp err || fail=1 +for option in '' -s; do + printf 'a\0' | grep $option a > out 2> err || fail=1 + compare /dev/null out || fail=1 + compare exp err || fail=1 +done Exit $fail |