grep-commit
[Top][All Lists]
Advanced

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

grep branch, master, updated. v2.20-75-g74c1f30


From: Paul Eggert
Subject: grep branch, master, updated. v2.20-75-g74c1f30
Date: Mon, 03 Nov 2014 06:12:07 +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  74c1f309e35d456c48efed5d2193df4f66b67272 (commit)
      from  8ea1c520a237586f2c1909c7b9cd3223414a5d1c (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=74c1f309e35d456c48efed5d2193df4f66b67272


commit 74c1f309e35d456c48efed5d2193df4f66b67272
Author: Paul Eggert <address@hidden>
Date:   Sun Nov 2 22:11:34 2014 -0800

    grep: port O_NOFOLLOW errno checking to NetBSD
    
    Problem reported by Assaf Gordon in: http://bugs.gnu.org/18892
    * NEWS: Document it.
    * src/grep.c (open_symlink_nofollow_error):
    New function, which does the right thing on NetBSD.
    (grepfile): Use it.

diff --git a/NEWS b/NEWS
index 183b7f0..c465162 100644
--- a/NEWS
+++ b/NEWS
@@ -48,6 +48,10 @@ GNU grep NEWS                                    -*- outline 
-*-
   grep -E rejected unmatched ')', instead of treating it like '\)'.
   [bug present since "the beginning"]
 
+  On NetBSD, grep -r no longer reports "Inappropriate file type or format"
+  when refusing to follow a symbolic link.
+  [bug introduced in grep-2.12]
+
 ** Changes in behavior
 
   The GREP_OPTIONS environment variable is now obsolescent, and grep
diff --git a/src/grep.c b/src/grep.c
index 0a4ac27..8dbf86e 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -1513,13 +1513,27 @@ grepdirent (FTS *fts, FTSENT *ent, bool command_line)
   return grepfile (dirdesc, ent->fts_accpath, follow, command_line);
 }
 
+/* True if errno is ERR after 'open ("symlink", ... O_NOFOLLOW ...)'.
+   POSIX specifies ELOOP, but it's EMLINK on FreeBSD and EFTYPE on NetBSD.  */
+static bool
+open_symlink_nofollow_error (int err)
+{
+  if (err == ELOOP || err == EMLINK)
+    return true;
+#ifdef EFTYPE
+  if (err == EFTYPE)
+    return true;
+#endif
+  return false;
+}
+
 static bool
 grepfile (int dirdesc, char const *name, bool follow, bool command_line)
 {
   int desc = openat_safer (dirdesc, name, O_RDONLY | (follow ? 0 : 
O_NOFOLLOW));
   if (desc < 0)
     {
-      if (follow || (errno != ELOOP && errno != EMLINK))
+      if (follow || ! open_symlink_nofollow_error (errno))
         suppressible_error (filename, errno);
       return true;
     }

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

Summary of changes:
 NEWS       |    4 ++++
 src/grep.c |   16 +++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

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