New rename(2) function

Eric Blake
Fri Aug 10 21:51:00 GMT 2007

According to Christian Franke on 8/10/2007 3:34 PM:
>> Ouch.  Coreutils decided that since Foo and foo represent the same file
>> (and on a case-insensitive system, they do), and since Foo has more than
>> one link, that it was safe to unlink Foo because the data would be
>> left in
>> foo.  But how is coreutils supposed to know when a file system is
>> case-insensitive, such that unlinking Foo is the wrong action?  In other
>> words, how do you distinguish between two spellings of the same directory
>> entry, which is a different matter than two directory entries to the same
>> inode?
> This is probably impossible in the general case, when only POSIX
> compliant OS functions can be used.
> For Cygwin, the attached patch for same_name() fixes the above problem.
> Should also work on managed mounts.

But your suggested patch breaks in the face of hard links with different
names; you would need to do the case-insensitive comparison, then if that
fails, fall back on stat()-based comparison, before making the final decision.

Don't work too hard, make some time for fun as well!

Eric Blake   

More information about the Cygwin-developers mailing list