[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
grep branch, master, updated. v2.11-17-g55cf7b6
From: |
Jim Meyering |
Subject: |
grep branch, master, updated. v2.11-17-g55cf7b6 |
Date: |
Tue, 17 Apr 2012 15:29:42 +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 55cf7b6a1905320c36702a476b09ebb29a2934d3 (commit)
from a2e0193455e620f6bad1005500da418d9eba2ae6 (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=55cf7b6a1905320c36702a476b09ebb29a2934d3
commit 55cf7b6a1905320c36702a476b09ebb29a2934d3
Author: Jim Meyering <address@hidden>
Date: Tue Apr 17 13:37:10 2012 +0200
grep: fix --devices=ACTION (-D) so stdin is once again exempt
An oversight in the 2.11 changes made it so "echo x|grep x" would
fail for those who set GREP_OPTIONS=--devices=skip.
* src/main.c (grepdesc): Ignore skip-related options when reading
from standard input.
* tests/skip-device: New file. Test for the above.
* tests/Makefile.am (TESTS): Add it.
* doc/grep.texi (File and Directory Selection): Clarify this point,
documenting the stdin exemption.
* NEWS (Bug fixes): Mention it, and add a few "[fixed in ...] notes.
Reported by Tino Keitel in http://bugs.debian.org/669084,
and forwarded to bug-grep by AnÃbal Monsalve Salazar.
diff --git a/NEWS b/NEWS
index b219b65..a065394 100644
--- a/NEWS
+++ b/NEWS
@@ -4,13 +4,17 @@ GNU grep NEWS -*- outline
-*-
** Bug fixes
+ "echo P|grep --devices=skip P" once again prints P, as it did in 2.10
+ [bug introduced in grep-2.11]
+
grep no longer segfaults with -r --exclude-dir and no file operand.
I.e., ":|grep -r --exclude-dir=D PAT" would segfault.
+ [bug introduced in grep-2.11]
Recursive grep now uses fts for directory traversal, so it can
handle much-larger directories without reporting things like "File
name too long", and it can run much faster when dealing with large
- directory hierarchies.
+ directory hierarchies. [bug present since the beginning]
grep -E 'a{1000000000}' now reports an overflow error rather than
silently acting like grep -E 'a\{1000000000}'.
@@ -27,6 +31,7 @@ GNU grep NEWS -*- outline
-*-
use -R if you prefer the old behavior of following all symlinks and
defaulting to reading all devices.
+
* Noteworthy changes in release 2.11 (2012-03-02) [stable]
** Bug fixes
diff --git a/doc/grep.texi b/doc/grep.texi
index 1840e21..000a844 100644
--- a/doc/grep.texi
+++ b/doc/grep.texi
@@ -614,6 +614,7 @@ By default, devices are read if they are on the command
line or if the
@option{-R} (@option{--dereference-recursive}) option is used, and are
skipped if they are encountered recursively and the @option{-r}
(@option{--recursive}) option is used.
+This option has no effect on a file that is read via standard input.
@item -d @var{action}
@itemx address@hidden
diff --git a/src/main.c b/src/main.c
index 82cae33..c5a8489 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1367,10 +1367,11 @@ grepdesc (int desc, int command_line)
suppressible_error (filename, errno);
return status;
}
- if ((directories == SKIP_DIRECTORIES && S_ISDIR (st.st_mode))
- || ((devices == SKIP_DEVICES
- || (devices == READ_COMMAND_LINE_DEVICES && !command_line))
- && is_device_mode (st.st_mode)))
+ if (desc != STDIN_FILENO
+ && ((directories == SKIP_DIRECTORIES && S_ISDIR (st.st_mode))
+ || ((devices == SKIP_DEVICES
+ || (devices == READ_COMMAND_LINE_DEVICES && !command_line))
+ && is_device_mode (st.st_mode))))
goto closeout;
/* If there is a regular file on stdout and the current file refers
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 13061fe..d0d622b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -78,6 +78,7 @@ TESTS = \
r-dot \
repetition-overflow \
reversed-range-endpoints \
+ skip-device \
sjis-mb \
spencer1 \
spencer1-locale \
diff --git a/tests/skip-device b/tests/skip-device
new file mode 100755
index 0000000..40645ea
--- /dev/null
+++ b/tests/skip-device
@@ -0,0 +1,14 @@
+#!/bin/sh
+# grep must ignore --devices=ACTION (-D) when reading stdin
+# For grep-2.11, this test would fail.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+
+# Test both with no file argument, and with "-".
+echo foo | grep -D skip foo - || fail=1
+echo foo | grep --devices=skip foo || fail=1
+
+# It's more insidious when the skip option is via the envvar:
+echo foo | GREP_OPTIONS=--devices=skip grep foo || fail=1
+
+Exit $fail
-----------------------------------------------------------------------
Summary of changes:
NEWS | 7 ++++++-
doc/grep.texi | 1 +
src/main.c | 9 +++++----
tests/Makefile.am | 1 +
tests/skip-device | 14 ++++++++++++++
5 files changed, 27 insertions(+), 5 deletions(-)
create mode 100755 tests/skip-device
hooks/post-receive
--
grep
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- grep branch, master, updated. v2.11-17-g55cf7b6,
Jim Meyering <=