[PATCH 2 of 2] grep: -r should recurse into symlinks to directories

Thomas De Schampheleire patrickdepinguin at gmail.com
Tue Jul 29 08:45:13 UTC 2014


The command
    grep -r . symlink_to_dir
should recurse into the directory pointed to by symlink_to_dir.
This patch fixes grep to implement this case.
This also fixes the newly added test in the testsuite.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire at gmail.com>

---
 findutils/grep.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff -r 66406add5e60 -r 8c87fa8591be findutils/grep.c
--- a/findutils/grep.c	Mon Jul 28 16:33:41 2014 +0200
+++ b/findutils/grep.c	Mon Jul 28 16:38:36 2014 +0200
@@ -668,7 +668,7 @@
 	int matched = 0;
 	recursive_action(dir,
 		/* recurse=yes */ ACTION_RECURSE |
-		/* followLinks=no */
+		/* followLinks=yes */ ACTION_FOLLOWLINKS |
 		/* depthFirst=yes */ ACTION_DEPTHFIRST,
 		/* fileAction= */ file_action_grep,
 		/* dirAction= */ NULL,


More information about the busybox mailing list