grep-2.12 nearly introduced a regression in how it handles directory symlink loops, on some systems...
With this, all tests pass on FreeBSD 9.0. >From db96fc60d0a1f2ccb1b62a0d6a0739678efa042e Mon Sep 17 00:00:00 2001 From: Jim Meyering <[email protected]> Date: Thu, 12 Apr 2012 20:45:16 +0200 Subject: [PATCH] grep: handle symlinked directory loops as usual * src/main.c (grepfile): Treat EMLINK just like ELOOP, for systems like FreeBSD 9.0 on which we would otherwise report "Too many links" rather than ignoring that type of failure. E.g., "mkdir d; cd d; ln -s . a; grep -r ^" would print grep: a: Too many links and would exit with status 2. Now, it prints nothing and exits with status 1, as before. Reported by Nelson H. F. Beebe. --- src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index be1e2e6..82cae33 100644 --- a/src/main.c +++ b/src/main.c @@ -1311,7 +1311,7 @@ grepfile (int dirdesc, char const *name, int follow, int command_line) int desc = openat_safer (dirdesc, name, O_RDONLY | (follow ? 0 : O_NOFOLLOW)); if (desc < 0) { - if (follow || errno != ELOOP) + if (follow || (errno != ELOOP && errno != EMLINK)) suppressible_error (filename, errno); return 1; } -- 1.7.10.128.g7945c
