[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

How to fix issue #4023 (on Windows, 'svn rm missingItem' deletes the unversioned 'MissingItem' from disk)?

From: Johan Corveleyn <jcorvel_at_gmail.com>
Date: Sun, 15 Jan 2012 21:26:14 +0100

Hi,

I'm looking into fixing issue #4023. I'd like to have some feedback on
a possible solution, and some hints on how to best implement it.

The problem
-----------
- 'svn rm missingItem' (while there is a 'MissingItem' on disk, and
not a 'missingItem') will eventually call
adm.ops.c#svn_wc__delete_many, with 'missingItem' as one of the
targets (so far so good).

- svn_wc__delete_many, after updating wc.db, will eventually call
erase_unversioned_from_wc, which will call
svn_io_remove_file2('missingItem').

- At this point, we have a problem, because
svn_io_remove_file2('missingItem') will eventually call the Windows
API DeleteFileW, which will happily delete 'MissingItem' when given
the 'missingItem' argument.

Proposed solution
-----------------
Inside svn_wc__delete_many, we could find out that 'missingItem' is,
you know, missing, before we try to delete it from disk. In that case,
there is no need to call erase_unversioned_from_wc, so no call to
DeleteFileW occurs.

I can't come up with a better way, but if someone has other ideas, shoot.

If this is indeed the way to proceed, then I'd appreciate a small
hint/pointer: how do I find out (as cheaply as possible) whether the
target in question is missing? In the beginning of
svn_wc__delete_many, a call is done to svn_wc__db_read_info, but this
doesn't seem to give this information (status == normal, kind == file,
whether or not the file in question is missing from disk).

-- 
Johan
Received on 2012-01-15 21:27:09 CET

This is an archived mail posted to the Subversion Dev mailing list.