> I have compiled a copy of coreutils CVS with msysDVLPR-1.0.0-alpha of > MSYS. After I run 'rm -r *' to delete a directory with subdirectory, I > deleted everything in the directory except for itself. > > When I trace into this bug, I found the reason is because of getcwd.c: > when it does with a directory which is mounted, the MATCHING_INO (d, > thisino) is always false.
This is also a problem on modern cygwin, which may explain your problems with MSYS, since MSYS forked from an older version of cygwin. In short, the cygwin code for readdir(2) populates the d_ino member using a hash algorithm, but in stat(2) it populates the inode information with what the underlying OS provides. On Win98, the FAT filesystem has no concept of inode, so cygwin uses the same hash algorithm, and readdir() is accurate. But on WinNT, where NTFS has a valid inode number, stat() and readdir() disagree about a file's inode, and d_ino should be ignored. For cygwin, I worked around the issue by setting jm_cv_struct_dirent_d_ino=no before configuring, to force coreutils to ignore the d_ino member and fall back on stat instead. Ultimately, it would be nicer if the gnulib module for detecting a working d_ino member would detect that cygwin's implementation is broken on NTFS drives. -- Eric Blake _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils