[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
grep branch, master, updated. v2.25-89-gbf3ee23
From: |
Paul Eggert |
Subject: |
grep branch, master, updated. v2.25-89-gbf3ee23 |
Date: |
Fri, 9 Sep 2016 01:35:27 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grep".
The branch, master has been updated
via bf3ee23890db33e3d0bef5344e896d2cdfaa34aa (commit)
from 4b753219c0f7e57266d7b68032b7a5e3b2b9a404 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=bf3ee23890db33e3d0bef5344e896d2cdfaa34aa
commit bf3ee23890db33e3d0bef5344e896d2cdfaa34aa
Author: Paul Eggert <address@hidden>
Date: Thu Sep 8 18:33:14 2016 -0700
grep: encoding errors suppress just their line
From a suggestion by Marcello Perathoner (Bug#22838).
* NEWS, doc/grep.texi (File and Directory Selection): Document this.
* src/grep.c (print_line_head): Do not suppress later output lines
merely because an earlier output line would have had an encoding error.
* tests/encoding-error: Test for the new behavior.
diff --git a/NEWS b/NEWS
index 01be350..a63a7b2 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,11 @@ GNU grep NEWS -*- outline
-*-
* Noteworthy changes in release ?.? (????-??-??) [?]
+** Bug fixes
+
+ Grep no longer omits output merely because it follows an output line
+ suppressed due to encoding errors. [bug introduced in grep-2.21]
+
** Improvements
grep can be much faster now when standard output is /dev/null.
diff --git a/doc/grep.texi b/doc/grep.texi
index 7e51d45..fcfad42 100644
--- a/doc/grep.texi
+++ b/doc/grep.texi
@@ -610,18 +610,19 @@ Variables}), or null input bytes when the
@option{-z} (@option{--null-data}) option is not given (@pxref{Other
Options}).
-By default, @var{type} is @samp{binary}, and when @command{grep}
-discovers that a file is binary it suppresses any further output, and
-instead outputs either a one-line message saying that a binary file
-matches, or no message if there is no match.
+By default, @var{type} is @samp{binary}, and @command{grep}
+suppresses output afer null input binary data is discovered,
+and suppresses output lines that contain improperly encoded data.
+When some output is suppressed, @command{grep} follows any output
+with a one-line message saying that a binary file matches.
If @var{type} is @samp{without-match},
-when @command{grep} discovers that a file is binary
+when @command{grep} discovers null input binary data
it assumes that the rest of the file does not match;
this is equivalent to the @option{-I} option.
If @var{type} is @samp{text},
address@hidden processes a binary file as if it were text;
address@hidden processes binary data as if it were text;
this is equivalent to the @option{-a} option.
When @var{type} is @samp{binary}, @command{grep} may treat non-text
diff --git a/src/grep.c b/src/grep.c
index d07f5da..65916ca 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -1108,17 +1108,16 @@ print_offset (uintmax_t pos, int min_width, const char
*color)
static bool
print_line_head (char *beg, size_t len, char const *lim, char sep)
{
- bool encoding_errors = false;
if (binary_files != TEXT_BINARY_FILES)
{
char ch = beg[len];
- encoding_errors = buf_has_encoding_errors (beg, len);
+ bool encoding_errors = buf_has_encoding_errors (beg, len);
beg[len] = ch;
- }
- if (encoding_errors)
- {
- encoding_error_output = done_on_match = out_quiet = true;
- return false;
+ if (encoding_errors)
+ {
+ encoding_error_output = true;
+ return false;
+ }
}
bool pending_sep = false;
diff --git a/tests/encoding-error b/tests/encoding-error
index 4b5fcb5..0cbeffc 100755
--- a/tests/encoding-error
+++ b/tests/encoding-error
@@ -35,6 +35,10 @@ grep '^X' in >out
test $? = 1 || fail=1
compare /dev/null out || fail=1
+grep . in >out || fail=1
+(cat a j && printf 'Binary file in matches\n') >exp || framework_failure_
+compare exp out || fail=1
+
grep -a . in >out || fail=1
compare in out
-----------------------------------------------------------------------
Summary of changes:
NEWS | 5 +++++
doc/grep.texi | 13 +++++++------
src/grep.c | 13 ++++++-------
tests/encoding-error | 4 ++++
4 files changed, 22 insertions(+), 13 deletions(-)
hooks/post-receive
--
grep
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- grep branch, master, updated. v2.25-89-gbf3ee23,
Paul Eggert <=