Issue 1582 DeleteFile: permission denied (Access is denied.)

Title DeleteFile: permission denied (Access is denied.)
Priority urgent Status resolved
Milestone 2.4.x Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, eivuokko, jaredj, kirby, kowey, mornfall, simonmar, wglozer
Assigned To simonmar
Topics Hashed, Regression, Windows

Created on 2009-08-28.14:38:09 by simonmar, last changed 2010-06-15.21:30:46 by admin.

msg8570 (view) Author: simonmar Date: 2009-08-28.14:38:07
On Windows:

$ darcs show repo
Reading inventory of repository d:/builds/ghc-testing-OLD
          Type: darcs
        Format: darcs-1.0
          Root: d:/builds/ghc-testing-OLD
      Pristine: PlainPristine "_darcs/pristine"
         Cache: thisrepo:d:/builds/ghc-testing-OLD, cache:C:\Documents and
Settings\simonmar\Application Data\darcs\cache
boringfile Pref: .darcs-boring
Default Remote: x:/ghc-HEAD
   Num Patches: 20966
$ darcs w   
darcs.exe: DeleteFile: permission denied (Access is denied.)
$ darcs --version
2.3.0 (release)

--debug and --debug-verbose don't reveal anything.  I don't know of a way to
tell which file it's trying to delete - I tried StraceNt but that doesn't show
the string being passed to DeleteFile.
msg8571 (view) Author: simonmar Date: 2009-08-28.14:42:24
Oh, I should mention this is a regression since 2.2.1.
msg8572 (view) Author: kowey Date: 2009-08-28.16:09:30
This being a regression makes me want to see if we can fix it as soon as possible.

We should try and see if we can fix this for the darcs 2.3.1 release (if there
will be one).

Could somebody on Windows please attempt to reproduce this?
Salvatore, do you have a moment to investigate?
msg8762 (view) Author: simonmar Date: 2009-09-09.09:28:46
On a hunch, I deleted _darcs/index*, and that worked around it:

$ ls _darcs/in*
index          index_invalid  inventories/   
$ rm _darcs/index*
removed `_darcs/index'
removed `_darcs/index_invalid'
[CAMRESPPTA01] /d/builds/ghc-testing > darcs w -s
M ./includes/Rts.h +12
M ./rts/Capability.h -2 +2
M ./rts/FrontPanel.h -2 +2
M ./rts/GetTime.h -2 +2
M ./rts/Hash.h -2 +2
M ./rts/Papi.h -2 +2
M ./rts/Printer.h -2 +2
M ./rts/ProfHeap.h -2 +2
msg8763 (view) Author: simonmar Date: 2009-09-09.10:23:12
More on this: even after deleting the index/index_invalid files, the problem
comes back again.  It's not repeatable.  After doing a few commands (mainly
darcs whatsnew, and a couple of reverts), I had a broken repo again and had to
remove index/index_invalid.  

This makes darcs 2.3.0 kind of painful to use on Windows!
msg8764 (view) Author: kowey Date: 2009-09-09.11:11:53
Progress! Simon: could you see what happens when up upgrade to hashed-storage 0.3.7?

Petr: here's another one you may want to watch out for.
msg8768 (view) Author: mornfall Date: 2009-09-09.14:14:05
Simon, can you please try hashed-storage 0.3.7? (just cabal update, cabal
install hashed-storage, cabal install darcs --reinstall -f-curl, or so...) I
see this in hashed-storage history:

Mon Jul 20 12:59:55 CEST 2009  Petr Rockai <me@mornfall.net>
  * Avoid removing an in-use file on win32.

and I sort of bet that this is what is biting you... (the patch implements an
ugly workaround -- you should start seeing index.old files in _darcs... there's
really no better way currently to solve this on windows, we really need to
unlink an in-use file without clobbering it... it should be reasonably safe,
unless you hammer very hard on concurrent use of single repository from within
darcs -- but even if you hit that case, you should just get a permission denied
msg8834 (view) Author: kirby Date: 2009-09-17.14:10:30
This doesn't happen, as long as you use a recent version of hashed-storage (I 
used 0.3.8). The Windows binary of 2.3 should have this issue fixed, and we 
will make hashed-storage 0.3.8 mandatory for 2.3.1.
Please reopen if you can reproduce it with recent hashed-storage, or the 
Windows binary.
Date User Action Args
2009-08-28 14:38:09simonmarcreate
2009-08-28 14:42:26simonmarsetnosy: kowey, darcs-devel, simonmar, dmitry.kurochkin
messages: + msg8571
2009-08-28 16:09:38koweysetstatus: unknown -> needs-reproduction
priority: urgent
nosy: + kirby
messages: + msg8572
topic: + Regression, Target-2.4
assignedto: kirby
2009-09-09 09:28:49simonmarsetnosy: kowey, darcs-devel, simonmar, dmitry.kurochkin, kirby
messages: + msg8762
2009-09-09 10:23:14simonmarsetnosy: kowey, darcs-devel, simonmar, dmitry.kurochkin, kirby
messages: + msg8763
2009-09-09 11:12:02koweysetstatus: needs-reproduction -> waiting-for
nosy: + wglozer, mornfall, eivuokko, jaredj
topic: + Windows, Hashed
messages: + msg8764
assignedto: kirby -> simonmar
2009-09-09 14:14:07mornfallsetnosy: kowey, wglozer, darcs-devel, eivuokko, simonmar, jaredj, dmitry.kurochkin, mornfall, kirby
messages: + msg8768
2009-09-17 14:10:33kirbysetstatus: waiting-for -> resolved
nosy: kowey, wglozer, darcs-devel, eivuokko, simonmar, jaredj, dmitry.kurochkin, mornfall, kirby
messages: + msg8834
2009-10-23 22:36:37adminsetassignedto: simonmar -> marlowsd
nosy: + marlowsd
2009-10-23 22:38:31adminsetnosy: - simonmar
2009-10-23 23:34:46adminsetassignedto: marlowsd -> simonmar
nosy: + simonmar
2009-10-23 23:35:09adminsetnosy: - marlowsd
2010-06-15 21:30:43adminsetmilestone: 2.4.x
2010-06-15 21:30:46adminsettopic: - Target-2.4