Norihiro Tanaka wrote: > In current master, grep tests for matching with eolbyte to speed-up to > match with binary file, and `execute' is called in this process. > > I recognize that an input buffer to pass to `execute' must have the > eolbyte at the top as sentimental, although I don't think that this bug > is caused by that.
Sorry, the previous patch was wrong. I corrected it.
From 8e7ca11f4c8f654436d974d60af1038464c1fcc3 Mon Sep 17 00:00:00 2001 From: Norihiro Tanaka <nori...@kcn.ne.jp> Date: Fri, 3 Oct 2014 07:53:06 +0900 Subject: [PATCH] grep: testing matching with eolbyte, put a sentinel in an input buffer src/grep.c (grep): Testing matching with eolbyte, put a sentinel in an input buffer. --- src/grep.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/grep.c b/src/grep.c index bb5ba1c..80d83a5 100644 --- a/src/grep.c +++ b/src/grep.c @@ -2513,8 +2513,9 @@ main (int argc, char **argv) compile (keys, keycc); free (keys); + char eolbytes[2] = { eolbyte, eolbyte }; size_t match_size; - skip_empty_lines = ((execute (&eolbyte, 1, &match_size, NULL) == 0) + skip_empty_lines = ((execute (&eolbytes[1], 1, &match_size, NULL) == 0) == out_invert); if ((argc - optind > 1 && !no_filenames) || with_filenames) -- 2.1.1