[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
grep branch, master, updated. v2.10-20-gd0be2a6
From: |
Jim Meyering |
Subject: |
grep branch, master, updated. v2.10-20-gd0be2a6 |
Date: |
Sat, 24 Dec 2011 14:27:48 +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 d0be2a62a38726211cd94a06fd7e9aa23a88d07d (commit)
via adfe8bb24cbdb0c0feaf69e573ba6c023921cd33 (commit)
via 5c24afd142b57d9378a1e0a735f8056d7592a800 (commit)
from 1ca631f8e3cffa22554865ac11903b5afa647c00 (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=d0be2a62a38726211cd94a06fd7e9aa23a88d07d
commit d0be2a62a38726211cd94a06fd7e9aa23a88d07d
Author: Paul Eggert <address@hidden>
Date: Sat Dec 24 02:17:47 2011 -0800
don't ignore errors when reading a directory
grep no longer silently suppresses errors when reading a directory
as if it were a text file. For example, "grep x ." now reports a
read error on most systems; formerly, it ignored the error.
Problem reported as an aside by Bob Proulx (Bug#10355).
* NEWS: Document this.
* src/main.c (grep, grepfile): Implement this. Simplify the code
considerably.
* src/system.h (is_EISDIR): Remove; no longer needed.
diff --git a/NEWS b/NEWS
index 32cb32e..3824159 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,11 @@ GNU grep NEWS -*- outline
-*-
** Bug fixes
+ grep no longer silently suppresses errors when reading a directory
+ as if it were a text file. For example, "grep x ." now reports a
+ read error on most systems; formerly, it ignored the error.
+ [bug introduced in grep-2.5]
+
The --include, --exclude, and --exclude-dir options now handle
command-line arguments more consistently. --include and --exclude
apply only to non-directories and --exclude-dir applies only to
diff --git a/src/main.c b/src/main.c
index 70197f4..1e1667a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1098,8 +1098,7 @@ grep (int fd, char const *file, struct stats *stats)
if (! fillbuf (save, stats))
{
- if (! is_EISDIR (errno, file))
- suppressible_error (filename, errno);
+ suppressible_error (filename, errno);
return 0;
}
@@ -1170,8 +1169,7 @@ grep (int fd, char const *file, struct stats *stats)
nlscan (beg);
if (! fillbuf (save, stats))
{
- if (! is_EISDIR (errno, file))
- suppressible_error (filename, errno);
+ suppressible_error (filename, errno);
goto finish_grep;
}
}
@@ -1252,37 +1250,10 @@ grepfile (char const *file, struct stats *stats)
if (desc < 0)
{
int e = errno;
-
- if (is_EISDIR (e, file) && directories == RECURSE_DIRECTORIES)
- {
- if (stat (file, &stats->stat) != 0)
- {
- error (0, errno, "%s", file);
- return 1;
- }
-
- return grepdir (file, stats);
- }
-
- if (!suppress_errors)
- {
- if (directories == SKIP_DIRECTORIES)
- switch (e)
- {
-#if defined EISDIR
- case EISDIR:
- return 1;
-#endif
- case EACCES:
- /* When skipping directories, don't worry about
- directories that can't be opened. */
- if (isdir (file))
- return 1;
- break;
- }
- }
-
- suppressible_error (file, e);
+ /* When skipping directories, don't worry about directories
+ that can't be opened. */
+ if (! (directories == SKIP_DIRECTORIES && isdir (file)))
+ suppressible_error (file, e);
return 1;
}
diff --git a/src/system.h b/src/system.h
index e7afc46..db2fea3 100644
--- a/src/system.h
+++ b/src/system.h
@@ -33,12 +33,6 @@
# define HAVE_DOS_FILE_CONTENTS 1
#endif
-#ifdef EISDIR
-# define is_EISDIR(e, f) ((e) == EISDIR)
-#else
-# define is_EISDIR(e, f) 0
-#endif
-
#include <stdlib.h>
#include <stddef.h>
#include <limits.h>
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=adfe8bb24cbdb0c0feaf69e573ba6c023921cd33
commit d0be2a62a38726211cd94a06fd7e9aa23a88d07d
Author: Paul Eggert <address@hidden>
Date: Sat Dec 24 02:17:47 2011 -0800
don't ignore errors when reading a directory
grep no longer silently suppresses errors when reading a directory
as if it were a text file. For example, "grep x ." now reports a
read error on most systems; formerly, it ignored the error.
Problem reported as an aside by Bob Proulx (Bug#10355).
* NEWS: Document this.
* src/main.c (grep, grepfile): Implement this. Simplify the code
considerably.
* src/system.h (is_EISDIR): Remove; no longer needed.
diff --git a/NEWS b/NEWS
index 32cb32e..3824159 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,11 @@ GNU grep NEWS -*- outline
-*-
** Bug fixes
+ grep no longer silently suppresses errors when reading a directory
+ as if it were a text file. For example, "grep x ." now reports a
+ read error on most systems; formerly, it ignored the error.
+ [bug introduced in grep-2.5]
+
The --include, --exclude, and --exclude-dir options now handle
command-line arguments more consistently. --include and --exclude
apply only to non-directories and --exclude-dir applies only to
diff --git a/src/main.c b/src/main.c
index 70197f4..1e1667a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1098,8 +1098,7 @@ grep (int fd, char const *file, struct stats *stats)
if (! fillbuf (save, stats))
{
- if (! is_EISDIR (errno, file))
- suppressible_error (filename, errno);
+ suppressible_error (filename, errno);
return 0;
}
@@ -1170,8 +1169,7 @@ grep (int fd, char const *file, struct stats *stats)
nlscan (beg);
if (! fillbuf (save, stats))
{
- if (! is_EISDIR (errno, file))
- suppressible_error (filename, errno);
+ suppressible_error (filename, errno);
goto finish_grep;
}
}
@@ -1252,37 +1250,10 @@ grepfile (char const *file, struct stats *stats)
if (desc < 0)
{
int e = errno;
-
- if (is_EISDIR (e, file) && directories == RECURSE_DIRECTORIES)
- {
- if (stat (file, &stats->stat) != 0)
- {
- error (0, errno, "%s", file);
- return 1;
- }
-
- return grepdir (file, stats);
- }
-
- if (!suppress_errors)
- {
- if (directories == SKIP_DIRECTORIES)
- switch (e)
- {
-#if defined EISDIR
- case EISDIR:
- return 1;
-#endif
- case EACCES:
- /* When skipping directories, don't worry about
- directories that can't be opened. */
- if (isdir (file))
- return 1;
- break;
- }
- }
-
- suppressible_error (file, e);
+ /* When skipping directories, don't worry about directories
+ that can't be opened. */
+ if (! (directories == SKIP_DIRECTORIES && isdir (file)))
+ suppressible_error (file, e);
return 1;
}
diff --git a/src/system.h b/src/system.h
index e7afc46..db2fea3 100644
--- a/src/system.h
+++ b/src/system.h
@@ -33,12 +33,6 @@
# define HAVE_DOS_FILE_CONTENTS 1
#endif
-#ifdef EISDIR
-# define is_EISDIR(e, f) ((e) == EISDIR)
-#else
-# define is_EISDIR(e, f) 0
-#endif
-
#include <stdlib.h>
#include <stddef.h>
#include <limits.h>
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=5c24afd142b57d9378a1e0a735f8056d7592a800
commit d0be2a62a38726211cd94a06fd7e9aa23a88d07d
Author: Paul Eggert <address@hidden>
Date: Sat Dec 24 02:17:47 2011 -0800
don't ignore errors when reading a directory
grep no longer silently suppresses errors when reading a directory
as if it were a text file. For example, "grep x ." now reports a
read error on most systems; formerly, it ignored the error.
Problem reported as an aside by Bob Proulx (Bug#10355).
* NEWS: Document this.
* src/main.c (grep, grepfile): Implement this. Simplify the code
considerably.
* src/system.h (is_EISDIR): Remove; no longer needed.
diff --git a/NEWS b/NEWS
index 32cb32e..3824159 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,11 @@ GNU grep NEWS -*- outline
-*-
** Bug fixes
+ grep no longer silently suppresses errors when reading a directory
+ as if it were a text file. For example, "grep x ." now reports a
+ read error on most systems; formerly, it ignored the error.
+ [bug introduced in grep-2.5]
+
The --include, --exclude, and --exclude-dir options now handle
command-line arguments more consistently. --include and --exclude
apply only to non-directories and --exclude-dir applies only to
diff --git a/src/main.c b/src/main.c
index 70197f4..1e1667a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1098,8 +1098,7 @@ grep (int fd, char const *file, struct stats *stats)
if (! fillbuf (save, stats))
{
- if (! is_EISDIR (errno, file))
- suppressible_error (filename, errno);
+ suppressible_error (filename, errno);
return 0;
}
@@ -1170,8 +1169,7 @@ grep (int fd, char const *file, struct stats *stats)
nlscan (beg);
if (! fillbuf (save, stats))
{
- if (! is_EISDIR (errno, file))
- suppressible_error (filename, errno);
+ suppressible_error (filename, errno);
goto finish_grep;
}
}
@@ -1252,37 +1250,10 @@ grepfile (char const *file, struct stats *stats)
if (desc < 0)
{
int e = errno;
-
- if (is_EISDIR (e, file) && directories == RECURSE_DIRECTORIES)
- {
- if (stat (file, &stats->stat) != 0)
- {
- error (0, errno, "%s", file);
- return 1;
- }
-
- return grepdir (file, stats);
- }
-
- if (!suppress_errors)
- {
- if (directories == SKIP_DIRECTORIES)
- switch (e)
- {
-#if defined EISDIR
- case EISDIR:
- return 1;
-#endif
- case EACCES:
- /* When skipping directories, don't worry about
- directories that can't be opened. */
- if (isdir (file))
- return 1;
- break;
- }
- }
-
- suppressible_error (file, e);
+ /* When skipping directories, don't worry about directories
+ that can't be opened. */
+ if (! (directories == SKIP_DIRECTORIES && isdir (file)))
+ suppressible_error (file, e);
return 1;
}
diff --git a/src/system.h b/src/system.h
index e7afc46..db2fea3 100644
--- a/src/system.h
+++ b/src/system.h
@@ -33,12 +33,6 @@
# define HAVE_DOS_FILE_CONTENTS 1
#endif
-#ifdef EISDIR
-# define is_EISDIR(e, f) ((e) == EISDIR)
-#else
-# define is_EISDIR(e, f) 0
-#endif
-
#include <stdlib.h>
#include <stddef.h>
#include <limits.h>
-----------------------------------------------------------------------
Summary of changes:
NEWS | 12 ++++++++
gnulib | 2 +-
src/main.c | 68 ++++++++++++++++++-------------------------------
src/system.h | 6 ----
tests/include-exclude | 6 +++-
5 files changed, 43 insertions(+), 51 deletions(-)
hooks/post-receive
--
grep
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- grep branch, master, updated. v2.10-20-gd0be2a6,
Jim Meyering <=