On 06/13/2016 01:52 PM, Bjoern Voigt wrote:
The manual page says about the auto guessing code:
That's a typo in the man page, and I installed the attached patch to fix it. This should address the first four points you mentioned. As for the remaining points, grep does not consider binary data to be an error. Although there is a judgment call as to whether a matching-lines notification should be sent to stdout or stderr when input contains binary data, grep has been behaving this way for some time (GNU diff even longer) and it would be a hassle to change it at this point.
For GNU grep, you should be able to work around the issue by using the -a option. Other grep implementations may or may not work; in my experience, sending NUL bytes to them can sometimes make them dump core or artificially truncate their output.
From 832bfd8d1dd7c8e2358b08d18ca211182d0d44e7 Mon Sep 17 00:00:00 2001 From: Paul Eggert <eggert@cs.ucla.edu> Date: Mon, 13 Jun 2016 15:14:56 -0700 Subject: [PATCH] doc: remove obsolete MS-DOS mention MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * doc/grep.in.1: Remove obsolete discussion of MS-DOS heuristics. Problem reported by Björn Voigt in: http://bugs.gnu.org/23763 --- doc/grep.in.1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/grep.in.1 b/doc/grep.in.1 index 1a3b7d2..8525ca4 100644 --- a/doc/grep.in.1 +++ b/doc/grep.in.1 @@ -502,8 +502,9 @@ This can cause a performance penalty. Treat the file(s) as binary. By default, under \s-1MS-DOS\s0 and \s-1MS\s0-Windows, .BR grep -guesses the file type by looking at the contents of the first 32KB -read from the file. +guesses whether a file is text or binary as described for the +.B \-\^\-binary\-files +option. If .BR grep decides the file is a text file, it strips the CR characters from the -- 2.5.5