[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
grep branch, master, updated. v2.27-4-gca66d6f
From: |
Paul Eggert |
Subject: |
grep branch, master, updated. v2.27-4-gca66d6f |
Date: |
Mon, 12 Dec 2016 16:34:04 +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 ca66d6f9cc769c3cb6ff3293725b8742840b98fa (commit)
from a3721c43f96beb255c533118bfaba1ddf8d9a6be (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=ca66d6f9cc769c3cb6ff3293725b8742840b98fa
commit ca66d6f9cc769c3cb6ff3293725b8742840b98fa
Author: Paul Eggert <address@hidden>
Date: Mon Dec 12 08:31:32 2016 -0800
grep: work around proc lseek glitch
Problem reported by Andreas Schwab (Bug#25180).
* NEWS: Document this.
* src/grep.c (finalize_input): Ignore EINVAL lseek failures.
* tests/Makefile.am (TESTS): Add proc.
* tests/proc: New file.
diff --git a/NEWS b/NEWS
index f33001d..aa0483b 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,12 @@ GNU grep NEWS -*- outline
-*-
* Noteworthy changes in release ?.? (????-??-??) [?]
+** Bug fixes
+
+ grep no longer fails when standard input is a file in the Linux
+ /proc file system and standard output is /dev/null.
+ [bug introduced in grep-2.27]
+
* Noteworthy changes in release 2.27 (2016-12-06) [stable]
diff --git a/src/grep.c b/src/grep.c
index 1e910cb..30e0f54 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -1760,9 +1760,12 @@ finalize_input (int fd, struct stat const *st, bool
ineof)
{
if (fd == STDIN_FILENO
&& (outleft
- ? (!ineof && (seek_failed
- ? ! drain_input (fd, st)
- : lseek (fd, 0, SEEK_END) < 0))
+ ? (!ineof
+ && (seek_failed
+ || (lseek (fd, 0, SEEK_END) < 0
+ /* Linux proc file system has EINVAL (Bug#25180). */
+ && errno != EINVAL))
+ && ! drain_input (fd, st))
: (bufoffset != after_last_match && !seek_failed
&& lseek (fd, after_last_match, SEEK_SET) < 0)))
suppressible_error (errno);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3ded7a7..52e2b9e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -141,6 +141,7 @@ TESTS = \
pcre-z \
posix-bracket \
prefix-of-multibyte \
+ proc \
r-dot \
repetition-overflow \
reversed-range-endpoints \
diff --git a/tests/proc b/tests/proc
new file mode 100755
index 0000000..aeb4a50
--- /dev/null
+++ b/tests/proc
@@ -0,0 +1,18 @@
+#! /bin/sh
+# Test the /proc file system if available.
+
+# Copyright 2016 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+
+fail=0
+
+test -r /proc/self/status || skip_ 'No /proc/self/status on this platform.'
+
+grep '^' </proc/self/status >/dev/null || fail=1
+
+Exit $fail
-----------------------------------------------------------------------
Summary of changes:
NEWS | 6 ++++++
src/grep.c | 9 ++++++---
tests/Makefile.am | 1 +
tests/{pcre-o => proc} | 11 ++++++-----
4 files changed, 19 insertions(+), 8 deletions(-)
copy tests/{pcre-o => proc} (54%)
hooks/post-receive
--
grep
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- grep branch, master, updated. v2.27-4-gca66d6f,
Paul Eggert <=