rename() on vfat partition "bug"

Vladimir Volovich (
Sat, 19 Apr 1997 00:46:31 +0400


When one tries to rename() a file on a vfat filesystem,
he will get a EEXIST error if the two filenames differ only
in cases of letters. For example, the following command
fails to "rename" a file:

% mv filename.txt FileName.txt

However, it is >possible< to "rename" a filename.txt to Filename.txt,
in two stages:

% mv filename.txt filename.txt.temp
% mv filename.txt.temp FileName.txt

Since vfat filesystem is capable to store the case of filename
(but is not capable to distinguish filenames wich differ only by case),
it seems to be a Right Thing, if rename() would actually rename a file.
This problem is closely connected with the problem raised here
earlier: may be, stat(), open() of an existing file and some other
syscalls should >not< be case sensitive on a vfat filesystem, but
creat() should correctly store the case of letters in the creating

With best regards, Vladimir.