[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
grep branch, master, updated. v2.14-15-g9401024
From: |
Paul Eggert |
Subject: |
grep branch, master, updated. v2.14-15-g9401024 |
Date: |
Tue, 20 Nov 2012 07:51:38 +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 9401024f7505dee3d14c1b520d0028bd9b8aa2ab (commit)
from b06f7a29a58bbdd5866afc1e92dba3fdc9e2ed59 (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=9401024f7505dee3d14c1b520d0028bd9b8aa2ab
commit 9401024f7505dee3d14c1b520d0028bd9b8aa2ab
Author: Paul Eggert <address@hidden>
Date: Mon Nov 19 23:50:40 2012 -0800
grep: diagnose read errors from -f dir, porting to Solaris
Problem reported by Dennis Clarke for Solaris 10 in
<http://lists.gnu.org/archive/html/bug-grep/2012-11/msg00009.html>.
* src/main.c (main): For -f F, diagnose any read errors
encountered when reading F.
* tests/Makefile.am (XFAIL_TESTS): Remove grep-dir.
* tests/grep-dir: Don't assume that directories cannot be read
via fread, as POSIX allows this and it can happen on Solaris.
diff --git a/src/main.c b/src/main.c
index 6750007..cadefd6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1860,6 +1860,7 @@ main (int argc, char **argv)
size_t cc;
int opt, status, prepended;
int prev_optind, last_recursive;
+ int fread_errno;
intmax_t default_context;
FILE *fp;
exit_failure = EXIT_TROUBLE;
@@ -2009,13 +2010,15 @@ main (int argc, char **argv)
;
keys = xrealloc (keys, keyalloc);
oldcc = keycc;
- while (!feof (fp)
- && (cc = fread (keys + keycc, 1, keyalloc - 1 - keycc, fp)) > 0)
+ while ((cc = fread (keys + keycc, 1, keyalloc - 1 - keycc, fp)) != 0)
{
keycc += cc;
if (keycc == keyalloc - 1)
keys = x2nrealloc (keys, &keyalloc, sizeof *keys);
}
+ fread_errno = errno;
+ if (ferror (fp))
+ error (EXIT_TROUBLE, fread_errno, "%s", optarg);
if (fp != stdin)
fclose (fp);
/* Append final newline if file ended in non-newline. */
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2f99a69..7565840 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -24,8 +24,7 @@ LDADD = ../lib/libgreputils.a $(LIBINTL) ../lib/libgreputils.a
# Remove this definition once the failing test passes.
XFAIL_TESTS = \
- word-delim-multibyte \
- grep-dir
+ word-delim-multibyte
# Equivalence classes are only supported when using the system
# matcher (which means only with glibc).
diff --git a/tests/grep-dir b/tests/grep-dir
index e005525..de14d62 100755
--- a/tests/grep-dir
+++ b/tests/grep-dir
@@ -4,14 +4,22 @@
mkdir a || framework_failure
-echo x | grep -f a/; { test $? -gt 1 && test $? -lt 128; } || fail=1
-echo x | grep -if a/; { test $? -gt 1 && test $? -lt 128; } || fail=1
-echo x | grep -Ff a/; { test $? -gt 1 && test $? -lt 128; } || fail=1
-echo x | grep -Fif a/; { test $? -gt 1 && test $? -lt 128; } || fail=1
+# Lower and upper bound of valid exit status for "grep -f DIR",
+# when reading from empty and nonempty files, respectively.
+if cat a >/dev/null 2>&1; then
+ l=1 u=1 L=0 U=1
+else
+ l=2 u=127 L=2 U=127
+fi
-grep -f a/ < /dev/null; { test $? -gt 1 && test $? -lt 128; } || fail=1
-grep -if a/ < /dev/null; { test $? -gt 1 && test $? -lt 128; } || fail=1
-grep -Ff a/ < /dev/null; { test $? -gt 1 && test $? -lt 128; } || fail=1
-grep -Fif a/ < /dev/null; { test $? -gt 1 && test $? -lt 128; } || fail=1
+echo x | grep -f a/; { test $? -ge $L && test $? -le $U; } || fail=1
+echo x | grep -if a/; { test $? -ge $L && test $? -le $U; } || fail=1
+echo x | grep -Ff a/; { test $? -ge $L && test $? -le $U; } || fail=1
+echo x | grep -Fif a/; { test $? -ge $L && test $? -le $U; } || fail=1
+
+grep -f a/ < /dev/null; { test $? -ge $l && test $? -le $u; } || fail=1
+grep -if a/ < /dev/null; { test $? -ge $l && test $? -le $u; } || fail=1
+grep -Ff a/ < /dev/null; { test $? -ge $l && test $? -le $u; } || fail=1
+grep -Fif a/ < /dev/null; { test $? -ge $l && test $? -le $u; } || fail=1
Exit $fail
-----------------------------------------------------------------------
Summary of changes:
src/main.c | 7 +++++--
tests/Makefile.am | 3 +--
tests/grep-dir | 24 ++++++++++++++++--------
3 files changed, 22 insertions(+), 12 deletions(-)
hooks/post-receive
--
grep
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- grep branch, master, updated. v2.14-15-g9401024,
Paul Eggert <=