[MERGE] [BUG 363837] Catch _win32_delete_readonly failure to remove file or directory and try to recover

Martin Pool mbp at sourcefrog.net
Wed May 6 09:10:35 BST 2009


2009/5/6 John Arbash Meinel <john at arbash-meinel.com>:
> I think we could
>
> 1) Insert a small wait loop after the process goes away to see if it
> releases the file. This will help fix transient things. We could try
> every 100ms or so, for a max of 1s.
>
> 2) After waiting, just give up with a warning that we couldn't delete
> the file.

This would be fine.  I don't know if it's a very high priority as
leaking a few temporary files, from an operation that's probably only
manually initiated should not be a big deal, but a patch for it would
be fine.

> I would make this very specific to windows + diff handling, rather than
> do it for all files we want to delete. I suppose 1&2 aren't terrible for
> generic, but I think we'll often have things open that won't be
> released, like Visual Studio editing.

I don't think it should be done from every delete operation, but I do
think it should be put in eg osutils where we can call it in other
cases.  For example I bet people sometimes get merge failures when it
wants to delete a file that's presently in use.  (Or maybe
treetransform already specially handles this?)  And I think there was
a one-off failure which seemed due to a virus scanner reading a file
in .bzr when we wanted to delete it.

-- 
Martin <http://launchpad.net/~mbp/>



More information about the bazaar mailing list