several more bugs found by coreutils

Eric Blake
Wed Feb 2 03:53:00 GMT 2005

Hash: SHA1

According to Christopher Faylor on 2/1/2005 2:51 PM:
> On Tue, Feb 01, 2005 at 08:58:03PM +0000, Eric Blake wrote:
>>readdir() populates the dirent.d_ino member with a hashed filename,
> This is not going to be fixed.  It's a longstanding problem.  There is
> no eay way to fix it which would not engender a slowdown in readdir
> for a little-used feature.

If it really is little-used and expensive to implement, why not just get
rid of the d_ino member?  POSIX allows this, as d_ino is only required
under full XSI support:

Portable programs are already programmed (coreutils uses an autoconf
check) to notice whether d_ino exists, and if not, fall back to stat()ing
directory members if they really need the inode.  When I recompiled the
coreutils pwd(1) program to overlook the existance of d_ino, it started
working correctly again.

For backwards compatibility with existing code, you will still need an
ino_t in the place of d_ino.  What about something like the following
idea?  Perhaps it would be useful to rename it d_hash, and add a
corresponding st_hash member to struct stat.  Then st_hash is always the
hash of the filename, whether it is also st_ino (on Win9x) or not (on
Win2k).  And programs that know the cygwin internals could then bypass
calling stat() by comparing the d_hash members, similar to what is
currently being attempted (but failing) by comparing the d_ino members.

- --
Life is short - so eat dessert first!

Eric Blake   
Version: GnuPG v1.4.0 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Thunderbird -


Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list