same-inode: make SAME_INODE tri-state, to port to mingw
authorEric Blake <ebb9@byu.net>
Wed, 23 Sep 2009 20:51:29 +0000 (14:51 -0600)
committerEric Blake <ebb9@byu.net>
Thu, 24 Sep 2009 01:34:35 +0000 (19:34 -0600)
commitb5eb8386645bf1bcfafa63c729ff9a86454def87
treea82f1335e2fabfff7ea302f4b02d219b5fc84456
parente97114feaa74c5f0516d76dcde67601e26462e95
same-inode: make SAME_INODE tri-state, to port to mingw

Mingw has the annoying habit (already documented in
doc/posix-functions/*stat) that st_ino is always 0.
This means that naive uses of SAME_INODE(a,b) would
succeed, even on distinct files.

Here's an analysis of all gnulib modules that used
the macro before this commit:

chdir-safer is safe - SAME_INODE protected by HAVE_READLINK
cycle-check - mingw has no dir hard links and no symlinks,
 so no directory cycles can occur, and we should ignore -1
fts - SAME_INODE protected by FTS_DEBUG
hash-triple - using -1 gives more hash collisions, but
 the results are still correct
openat-proc - SAME_INODE protected by stat("/proc/self")
same - no dir cycles, so files are only same with identical name
link-follow.m4 - configure test already correct on mingw
test-canonicalize* - test already passes on mingw
test-[l]stat - test already passes on mingw

* NEWS: Mention this change.
* lib/same-inode.h (same-inode.h): Recognize mingw limitation of
st_ino always being 0.
* lib/cycle-check.h (CYCLE_CHECK_REFLECT_CHDIR_UP): Update caller.
* lib/cycle-check.c (cycle_check): Likewise.
* lib/same.c (same_name): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
NEWS
lib/cycle-check.c
lib/cycle-check.h
lib/same-inode.h
lib/same.c