grep-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grep branch, master, updated. v2.24-3-gcce2fd5


From: Paul Eggert
Subject: grep branch, master, updated. v2.24-3-gcce2fd5
Date: Fri, 18 Mar 2016 16:41:29 +0000

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  cce2fd5520bba35cf9b264de2f1b6131304f19d2 (commit)
      from  1cec27a7f0e5c7bdc44a88ef51af09f87a8cbc24 (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=cce2fd5520bba35cf9b264de2f1b6131304f19d2


commit cce2fd5520bba35cf9b264de2f1b6131304f19d2
Author: Paul Eggert <address@hidden>
Date:   Fri Mar 18 09:40:49 2016 -0700

    grep: -oz now outputs null bytes, not newlines
    
    * NEWS: Document this.
    * doc/grep.texi (Other Options): Clarify that -z affects output
    as well as input data.
    * src/grep.c (print_line_middle): Output eolbyte, not newline, if -o.
    * tests/null-byte: Test -o too.
    * tests/pcre-context: Adjust test to match new behavior.

diff --git a/NEWS b/NEWS
index 9de07ab..34d6c89 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ GNU grep NEWS                                    -*- outline 
-*-
 
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
+** Bug fixes
+
+  grep -oz now uses null bytes, not newlines, to terminate output lines.
+  [bug introduced in grep-2.5]
 
 * Noteworthy changes in release 2.24 (2016-03-10) [stable]
 
diff --git a/doc/grep.texi b/doc/grep.texi
index 8883b27..074113b 100644
--- a/doc/grep.texi
+++ b/doc/grep.texi
@@ -762,8 +762,8 @@ on platforms other than MS-DOS and MS-Windows.
 @opindex -z
 @opindex --null-data
 @cindex zero-terminated lines
-Treat the input as a set of lines, each terminated by a zero byte (the
-ASCII NUL character) instead of a newline.
+Treat input and output data as sequences of lines, each terminated by
+a zero byte (the ASCII NUL character) instead of a newline.
 Like the @option{-Z} or @option{--null} option,
 this option can be used with commands like
 @samp{sort -z} to process arbitrary file names.
diff --git a/src/grep.c b/src/grep.c
index 94ddbef..8baca5a 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -1152,7 +1152,7 @@ print_line_middle (char *beg, char *lim,
           fwrite_errno (b, 1, match_size);
           pr_sgr_end_if (match_color);
           if (only_matching)
-            putchar_errno ('\n');
+            putchar_errno (eolbyte);
         }
     }
 
diff --git a/tests/null-byte b/tests/null-byte
index 1d62806..f9bb00e 100755
--- a/tests/null-byte
+++ b/tests/null-byte
@@ -60,4 +60,9 @@ printf '%s\n' xxx 'Binary file in matches' > exp || 
framework_failure_
 grep -E 'xxx|z' in >out || fail=1
 compare exp out || fail=1
 
+printf '%s\0' 'abcadc' >in || framework_failure_
+printf '%s\0' 'abc' 'adc' >exp || framework_failure_
+grep -oz 'a[^c]*c' in >out || fail=1
+compare exp out || fail=1
+
 Exit $fail
diff --git a/tests/pcre-context b/tests/pcre-context
index f0c96e0..b910a20 100755
--- a/tests/pcre-context
+++ b/tests/pcre-context
@@ -23,12 +23,10 @@ Preceded by 4 empty lines.
 EOF
 test $? -eq 0 || framework_failure_
 
-cat >exp <<'EOF'
-Preceded by 2 empty lines.
-Preceded by 3 empty lines.
-Preceded by 4 empty lines.
-EOF
-test $? -eq 0 || framework_failure_
+printf '%s\0' \
+       'Preceded by 2 empty lines.' \
+       'Preceded by 3 empty lines.' \
+       'Preceded by 4 empty lines.' >exp || framework_failure_
 
 fail=0
 

-----------------------------------------------------------------------

Summary of changes:
 NEWS               |    4 ++++
 doc/grep.texi      |    4 ++--
 src/grep.c         |    2 +-
 tests/null-byte    |    5 +++++
 tests/pcre-context |   10 ++++------
 5 files changed, 16 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

[Prev in Thread] Current Thread [Next in Thread]