GNU bug report logs - #16444
grep -r fails with "Bad file descriptor" for mingw-w64

Previous Next

Package: grep;

Reported by: "Stephan T. Lavavej" <stl <at> nuwen.net>

Date: 2014年1月14日 16:54:03 UTC

Severity: minor

Tags: moreinfo

Merged with 19777

Full log


View this message in rfc822 format

From: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
To: David Grayson <davidegrayson <at> gmail.com>
Cc: 16444 <at> debbugs.gnu.org
Subject: bug#16444: bug #16444: grep -r fails with "Bad file descriptor" for mingw-w64
Date: 2015年3月11日 23:06:22 +0900
On 2015年3月10日 22:20:28 -0700
David Grayson <davidegrayson <at> 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.

This bug report was last modified 10 years and 225 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.

AltStyle によって変換されたページ (->オリジナル) /