[cvsnt] "cvs unedit" and renaming files
Gareth McCaughan
gmccaughan at synaptics-uk.com
Wed Sep 7 16:39:32 BST 2005
One of my colleagues came to me with a puzzling error.
He was trying to do a "cvs unedit" using TortoiseCVS,
and getting a message along the lines of "[unedit aborted]
cannot rename CVS/Base/foo to foo: File exists".
After a bit of poking about, it turns out that
- this message comes from CVSNT
- the "File exists" bit of it comes from Windows'
strerror function
- it's a lie: although Microsoft's documentation
claims that rename() always fails when the new
filename is that of an existing file, that's
false and there's usually a different problem
- in this instance the real problem was that the
file in question was in use (i.e., someone else
had it open)
This is a bit sad usability-wise; my colleague was
deeply confused, and so was I (more so once I'd read
the source code and MS' documentation, according to
which a "cvs unedit" should *never* work!). Of course
there's no prospect of getting strerror to return
anything more helpful; but might it be worth considering
an ugly-but-practical measure such as checking errno
or even the return value from strerror (ugh!) and
conditionally appending a note along the lines of
| (This may actually indicate that the file is
| protected or currently in use.)
?
--
Gareth McCaughan
More information about the cvsnt
mailing list