On Tue, 10 Mar 2015 22:20:28 -0700 David Grayson <davidegray...@gmail.com> wrote:
> Hello. > > I am encountering this bug too. I would like to compile grep 2.21 for > Windows using mingw-w64 and Git Bash. But the grep that I end up compiling > exhibits several bugs related to recursive operation. To reproduce the > bugs, I made a directory called "testdir" with two empty directories named > "a" and "b" inside it. I used "cd" to go into the testdir. > > Here is a shell session showing bug A: > > $ ../src/grep.exe a -r > c:\Users\David\Documents\grep\grep-2.21\src\grep.exe: 9: Bad file > descriptor > > Here is a shell session showing bug B: > > $ ../src/grep.exe a -R > c:\Users\David\Documents\grep\grep-2.21\src\grep.exe: warning: a: > recursive directory loop > c:\Users\David\Documents\grep\grep-2.21\src\grep.exe: warning: b: > recursive directory loop SAME_INODE macro defined in same-inode.h to be used by fts.c is as following. # define SAME_INODE(a, b) \ ((a).st_ino == (b).st_ino \ && (a).st_dev == (b).st_dev) However, MinGW always returns ST_INO = 0, which is POSIX imcompatible. I see that it leads to the result that all directories is same. So if we compare the file path instead of st_ino, the bug may be fixed.