GNU bug report logs -
#47649
grep bug report - improper handling of file symlinks with -r option
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
*This is the original working grep behaviour - it found text inside files
that were symlinks:-*
(Note the output: "*./folder/testfile1:this is my test file*")
[root <at> ir2 ~]# grep --version
grep (GNU grep) 2.5.1
Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root <at> ir2 ~]# mkdir bugdemo
[root <at> ir2 ~]# cd bugdemo
[root <at> ir2 bugdemo]# echo "this is my test file" > testfile1
[root <at> ir2 bugdemo]# echo "this is my test file" > testfile2
[root <at> ir2 bugdemo]# mkdir folder
[root <at> ir2 bugdemo]# cd folder
[root <at> ir2 folder]# echo "this is my test file" > testfile3
[root <at> ir2 folder]# ln -s ../testfile1
[root <at> ir2 folder]# cd ..
[root <at> ir2 bugdemo]# unalias grep
[root <at> ir2 bugdemo]# grep -r test .
./testfile2:this is my test file
./folder/testfile1:this is my test file
./folder/testfile3:this is my test file
./testfile1:this is my test file
[root <at> ir2 bugdemo]#
*This is the now-broken current non-working grep behaviour - it fails to
find text inside files that were symlinks:-*
(Note the *missing* output: "*./folder/testfile1:this is my test file*")
[root <at> ir3 ~]# grep --version
grep (GNU grep) 3.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Haertel and others, see <
http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.
[root <at> ir3 ~]# mkdir bugdemo
[root <at> ir3 ~]# cd bugdemo
[root <at> ir3 bugdemo]# echo "this is my test file" > testfile1
[root <at> ir3 bugdemo]# echo "this is my test file" > testfile2
[root <at> ir3 bugdemo]# mkdir folder
[root <at> ir3 bugdemo]# cd folder
[root <at> ir3 folder]# echo "this is my test file" > testfile3
[root <at> ir3 folder]# ln -s ../testfile1
[root <at> ir3 folder]# cd ..
[root <at> ir3 bugdemo]# unalias grep
[root <at> ir3 bugdemo]# grep -r test .
./testfile1:this is my test file
./testfile2:this is my test file
./folder/testfile3:this is my test file
[root <at> ir3 bugdemo]#
It looks like processing exists to not recursively follow symlinks, and
someone has messed with that which has caused files to no longer be
searched by mistake.
[Message part 2 (text/html, inline)]
This bug report was last modified 3 years and 283 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.