0
I have a couple of files that I can't remove:
> rm foo
> rm: cannot remove 'foo': File exists
basically I also get the same error if I try to mv
the file, chmod
it or even if I try to cat
it.
To me this error confuses me. I think there may be many valid reasons why you can't do this and that with a file, but the file existing should not be a reason to fail removing it or do the other things.
What is actually going on here? Is there some other windows error that maps to EEXISTS
in a confusing way or what?
1That's a confusing message, alright. Cygwin provides its own version of
strace
which shows the Windows system calls used to run a command. To get more information on what's happening, you could install it and try running therm
command through that. – Anthony Geoghegan – 2017-10-12T09:11:56.163@AnthonyGeoghegan Thanks for the tip, it looks like
ERROR_FILE_CORRUPT
is translated toEEXIST
which is confusing at least in this case at least. I wonder what the scenario that was in their mind when they mapped it that way. – skyking – 2017-10-12T09:39:35.4371That sounds wrong to me - but there may be a good reason for it (e.g., no POSIX equivalent for a corrupted file error code). It might be worth raising the issue on their mailing list to get clarification on it. I'd also suggest that you put your findings into an answer (and accept it) so that it could help others in a similar situation. – Anthony Geoghegan – 2017-10-12T09:57:59.113