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

Re: Windows XP "Access denied" svn_io_rename

From: Branko Čibej <brane_at_xbc.nu>
Date: 2003-10-27 18:53:25 CET

James Van Artsdalen wrote:

>The patch that the FAQ points to does 100 iterations with a one
>millisecond sleep in each iteration. The sleep should be sufficient
>to yield the CPU to the process holding the file open so that it will
>finishing whatever it's doing and close the file.
That a) depends on what the other process is doing, and b) won't work on
multiprocessor machines.

>I would rather see the loop bounded by time - say five seconds -
>rather than a fixed number of iterations.
There's no real difference in practice -- both limits are arbitrary, and
may work for some people but not for others.

>Note that a bound is needed since the file may never become available.
>The simplest way for anti-virus software to sequester a file is to
>not close the file.
>The issue isn't atomicity but rather the Win32 API guarantee that a
>file cannot be renamed or deleted while open.
Win32 makes no such guarantee. A file _can_ be renamed or deleted while
open, it just won't disappear from the directory listing until the last
handle is closed. It would be amazingly simple to implement this if only
Win32 offered a rename-through-handle function...

>One alternate solution would be to call the underlying NT API
>directly, which can rename and delete open files. This does no good
>for Win9x and would require use of many undocumented OS calls, but it
>would allow the write-temp-rename-permanent method SVN uses.
Yikes. That's all we need.

>A more realistic alternative, if rename retries do not work, is to
>change write methodology to a rename of the permanent name to a .BAK
>and then writing the new data directly to the permanent name.
This is dangerous. If the write can't complete, we're stuck with a
clobbered working copy and no way to recover.

Brane Čibej   <brane_at_xbc.nu>   http://www.xbc.nu/brane/
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Oct 27 18:57:18 2003

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.