This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: revisiting case sensitivity


> > #!/bin/sh
> > /bin/mv "${1%%/}" "${1%%/}-$$" && mv "${1%%/}-$$" "${2%%/}"
> > -------------------- END /usr/local/bin/mvv --------------------
> >
> > Is this pretty much the final word at the moment?
> 
> I suppose it is.  I'm still getting the "are the same file" failure
> (which, BTW, only occurs with check_case:relaxed or check_case:adjust --
> with check_case:strict the error is "Filename exists with different
> case").
> 

Right now, on the relaxed and adjust case, stat(2) returns the same results for the two spellings, hence mv(1) thinking the files are the same without even trying a rename.  For the strict case, one stat(2) succeeds, and the other fails, so mv(1) goes on to perform rename(2), which fails because of the case difference.  POSIX requires rename(2) to be atomic, and there is no way for Windows to do that (you really do have to use an intermediate file name), so cygwin returns ECASECLASH, an invented errno, instead.

I don't know if it is worth my time as coreutils maintainer to write a cygwin specific patch to allow `mv a A' to succeed, by using an intermediate file, but PTC if someone else wants to contribute something.  Is anyone using an HFS+ file system on Mac (another case-preserving case-insensitive system) that can report what happens on that version of `mv a A'?  Does this corner case warrant an upstream request in coreutils to gracefully handle this?  Or someone could contribute a patch to cygwin to at least allow rename(2) to succeed, even though that will only help the strict case checking, not the relaxed or adjust forms where mv(1) doesn't even get to the rename(2).

--
Eric Blake



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]