error removeDirectoryRecursive permission denied

217 views
Skip to first unread message

kees Bleijenberg

unread,
Nov 5, 2016, 3:22:11 PM11/5/16
to haskell-stack
I edit the code in Atom, After a few updates I get the error removeDirectoryRecursive.....in the red box. When I cose Atom and I do stack build in cmd.exe I get again:
removeDirectoryRecursive: permission denied (Access is denied.)
If I remove the directory .stack-work and I do stack build again, everything is ok. But not for long. After a few updates of the code the error is back again.
I'am using stack version 1.1.2 on windows 7.

Kees

Michael Snoyman

unread,
Nov 7, 2016, 1:36:34 AM11/7/16
to kees Bleijenberg, haskell-stack
There's only one call to removeDirectoryRecursive I see in the Stack codebase, and that applies for install MSYS2 on Windows, which is probably _not_ relevant to what you're doing right now. Do you have any indication from the logs of what was happening immediately before or after? Can you run with `--verbose` and get more detailed logs? What about upgrading to the latest version of Stack?

--
You received this message because you are subscribed to the Google Groups "haskell-stack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-stack+unsubscribe@googlegroups.com.
To post to this group, send email to haskel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/haskell-stack/af6a4ed9-fc63-4c0f-af61-8e1e7849db3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

kees Bleijenberg

unread,
Nov 7, 2016, 4:51:08 AM11/7/16
to haskell-stack, mic...@snoyman.com
I've narrowed down the problem. I only get the problem when I add elm-export to the cabal and yaml file as described in the Installation part of https://github.com/krisajenkins/elm-export
The problem starts in Atom. Maybe the problem is not in stack but in ghc-mod??

stack -v buid 
Version 1.1.2, Git revision c6dac65e3174dea79df54ce6d56f3e98bc060ecc (3647 commits) x86_64 hpack-0.14.0
2016-11-07 10:38:21.067318: [debug] Checking for project config at: D:\TBSchilder_1.0.3.0\source\glas\stack.yaml @(stack_9kewhubnl5WIl89fhd1ea2:Stack.Config src/Stack\Config.hs:811:9)
2016-11-07 10:38:21.067318: [debug] Loading project config file stack.yaml @(stack_9kewhubnl5WIl89fhd1ea2:Stack.Config src/Stack\Config.hs:829:13)
2016-11-07 10:38:21.067318: [debug] Trying to decode D:\stackRoot\build-plan-cache\x86_64-windows\lts-7.2.cache @(stack_9kewhubnl5WIl89fhd1ea2:Data.Binary.VersionTagged src/Data\Binary\VersionTagged.hs:55:5)
2016-11-07 10:38:21.077318: [debug] Success decoding D:\stackRoot\build-plan-cache\x86_64-windows\lts-7.2.cache @(stack_9kewhubnl5WIl89fhd1ea2:Data.Binary.VersionTagged src/Data\Binary\VersionTagged.hs:64:13)
2016-11-07 10:38:21.087318: [debug] Getting system compiler version @(stack_9kewhubnl5WIl89fhd1ea2:Stack.Setup src/Stack\Setup.hs:341:17)
2016-11-07 10:38:21.087318: [debug] Asking GHC for its version @(stack_9kewhubnl5WIl89fhd1ea2:Stack.Setup.Installed src/Stack\Setup\Installed.hs:94:13)
2016-11-07 10:38:21.087318: [debug] Run process: ghc --numeric-version @(stack_9kewhubnl5WIl89fhd1ea2:System.Process.Read src/System\Process\Read.hs:283:3)
2016-11-07 10:38:21.107318: [debug] Getting Cabal package version @(stack_9kewhubnl5WIl89fhd1ea2:Stack.GhcPkg src/Stack\GhcPkg.hs:165:5)
2016-11-07 10:38:21.107318: [debug] Run process: ghc-pkg --no-user-package-db field --simple-output Cabal version @(stack_9kewhubnl5WIl89fhd1ea2:System.Process.Read src/System\Process\Read.hs:283:3)
2016-11-07 10:38:21.164320: [debug] Resolving package entries @(stack_9kewhubnl5WIl89fhd1ea2:Stack.Setup src/Stack\Setup.hs:221:5)
2016-11-07 10:38:21.164320: [debug] Run process: git reset --hard 2a026e4c3a93a18006595636e783955223f9b98e -- @(stack_9kewhubnl5WIl89fhd1ea2:System.Process.Read src/System\Process\Read.hs:283:3)
removeDirectoryRecursive: permission denied (Access is denied.)

After upgrading stack:
stack -v build
Version 1.2.0, Git revision 123819b7d65df2ad7fe63fb5eb39a98536acb5f3 (4055 commits) x86_64 hpack-0.14.0
2016-11-07 10:45:16.148733: [debug] Checking for project config at: D:\TBSchilder_1.0.3.0\source\glas\stack.yaml
@(Stack\Config.hs:792:9)
2016-11-07 10:45:16.149733: [debug] Loading project config file stack.yaml
@(Stack\Config.hs:810:13)
2016-11-07 10:45:16.152733: [debug] Trying to decode D:\stackRoot\build-plan-cache\x86_64-windows\lts-7.2.cache
@(Data\Store\VersionTagged.hs:68:5)
2016-11-07 10:45:16.164733: [debug] Success decoding D:\stackRoot\build-plan-cache\x86_64-windows\lts-7.2.cache
@(Data\Store\VersionTagged.hs:72:13)
2016-11-07 10:45:16.168734: [debug] Getting system compiler version
@(Stack\Setup.hs:354:17)
2016-11-07 10:45:16.183735: [debug] Using standard GHC build
@(Stack\Setup.hs:537:9)
2016-11-07 10:45:16.183735: [debug] Getting Cabal package version
@(Stack\GhcPkg.hs:171:5)2016-11-07 10:45:16.184735: [debug] Getting global package database location

2016-11-07 10:45:16.184735: [debug] Asking GHC for its version
@(Stack\GhcPkg.hs:54:5)@(Stack\Setup\Installed.hs:101:13)
2016-11-07 10:45:16.184735: [debug] Run process: C:\Users\kees\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.1\bin\ghc-pkg.EXE --no-user-package-db field --simple-output Cabal version

@(System\Process\Read.hs:277:3)2016-11-07 10:45:16.185735: [debug] Run process: C:\Users\kees\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.1\bin\ghc-pkg.EXE --no-user-package-db list --global

2016-11-07 10:45:16.185735: [debug] Run process: C:\Users\kees\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.1\bin\ghc.EXE --numeric-version
@(System\Process\Read.hs:277:3)@(System\Process\Read.hs:277:3)

2016-11-07 10:45:16.213736: [debug] Process finished in 21 ms: C:\Users\kees\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.1\bin\ghc.EXE --numeric-version
@(System\Process\Read.hs:277:3)
2016-11-07 10:45:16.251738: [debug] Process finished in 65 ms: C:\Users\kees\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.1\bin\ghc-pkg.EXE --no-user-package-db field --simple-output Cabal version
@(System\Process\Read.hs:277:3)
2016-11-07 10:45:16.251738: [debug] Process finished in 61 ms: C:\Users\kees\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.1\bin\ghc-pkg.EXE --no-user-package-db list --global
@(System\Process\Read.hs:277:3)
2016-11-07 10:45:16.251738: [debug] Resolving package entries
@(Stack\Setup.hs:234:5)
2016-11-07 10:45:16.260739: [debug] Run process: D:\Program Files\Git\cmd\git.EXE reset --hard 2a026e4c3a93a18006595636e783955223f9b98e --
@(System\Process\Read.hs:277:3)
2016-11-07 10:45:16.290741: [info] Failed to reset to commit 2a026e4c3a93a18006595636e783955223f9b98e, deleting and re-cloning.
@(Stack\Config.hs:580:21)
removeDirectoryRecursive: permission denied (Access is denied.)


On Monday, November 7, 2016 at 7:36:34 AM UTC+1, Michael Snoyman wrote:
There's only one call to removeDirectoryRecursive I see in the Stack codebase, and that applies for install MSYS2 on Windows, which is probably _not_ relevant to what you're doing right now. Do you have any indication from the logs of what was happening immediately before or after? Can you run with `--verbose` and get more detailed logs? What about upgrading to the latest version of Stack?
On Sat, Nov 5, 2016 at 9:22 PM, kees Bleijenberg <k.blei...@lijbrandt.nl> wrote:
I edit the code in Atom, After a few updates I get the error removeDirectoryRecursive.....in the red box. When I cose Atom and I do stack build in cmd.exe I get again:
removeDirectoryRecursive: permission denied (Access is denied.)
If I remove the directory .stack-work and I do stack build again, everything is ok. But not for long. After a few updates of the code the error is back again.
I'am using stack version 1.1.2 on windows 7.

Kees

--
You received this message because you are subscribed to the Google Groups "haskell-stack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-stac...@googlegroups.com.

Michael Snoyman

unread,
Nov 7, 2016, 4:55:26 AM11/7/16
to kees Bleijenberg, haskell-stack
That definitely narrows it down, it's a call to `removeDirRecur` in Stack.Config. I don't know what could be causing the permissions issues. Are you able to reproduce it with only Stack? Can you generate a minimal case that demonstrates the issue occurring?

To unsubscribe from this group and stop receiving emails from it, send an email to haskell-stack+unsubscribe@googlegroups.com.

To post to this group, send email to haskel...@googlegroups.com.

kees Bleijenberg

unread,
Nov 7, 2016, 8:59:08 AM11/7/16
to haskell-stack, mic...@snoyman.com
The error message from Stack is always after editting the code in Atom. I'll try to create a testcase. I doubt whether I get an error when editting the code with Notepad++. Reducing to a simpler case seems quit difficult to do.
I'am still not sure if this is a Stack problem. Maybe it is a haskell-ghc-mod problem https://github.com/atom-haskell/haskell-ghc-mod/issues/189 
It is a bit annoying that the error message doesn't tell what file/map is read-only and can't be deleted. I've searched in the directory of the program and its subdirs but nothing is read-only.
The log files in the map logs do not change when I get the error after stack build.

Kees

Michael Snoyman

unread,
Nov 7, 2016, 11:21:03 AM11/7/16
to kees Bleijenberg, haskell-stack
To speed things up more, you could create your own Stack executable with a modified version of the recursive deletion function that provides more information. (I agree, it would be much better if the directory package gave more meaningful error messages.) But I think your suspicion of ghc-mod may be correct.

To unsubscribe from this group and stop receiving emails from it, send an email to haskell-stack+unsubscribe@googlegroups.com.

To post to this group, send email to haskel...@googlegroups.com.

kees Bleijenberg

unread,
Nov 9, 2016, 4:30:52 AM11/9/16
to haskell-stack, mic...@snoyman.com
I've build stack on my own computer (easier then I expected). I replaced the call to removeRecurseDir with myRemoveRecurseDir. In myRemoveRecurseDir is one line: error $ show dir
Then I added to the empty main.hs the line: import Elm. Loaded the project in Atom. Did ctrl+s wthich triggers the building process. I get the error and closed Atom. In a cmd box I did stack build with my fresh build stack.exe.

This is the result:
d:\testElm\testElm>d:\stack\stack\.stack-work\install\e4874a87\bin\stack build 
Failed to reset to commit 2a026e4c3a93a18006595636e783955223f9b98e, deleting and re-cloning.
"D:\\testElm\\testElm\\.stack-work\\downloaded\\7A15yVYjrQP7\\"
This last line is the directory to delete.

Any idea what is going on?

Kees

kees Bleijenberg

unread,
Nov 9, 2016, 5:51:27 AM11/9/16
to haskell-stack
And this are the read only files:

 Volume in drive D is Hitatchi
 Volume Serial Number is 1216-75CD

 Directory of d:\testElm\testElm\.stack-work\downloaded\7A15yVYjrQP7\.git\objects\pack

09-11-2016  10:16            19.048 pack-203aee397363d85457057420049897bf87fc0980.idx
09-11-2016  10:16            99.220 pack-203aee397363d85457057420049897bf87fc0980.pack
               2 File(s)        118.268 bytes

     Total Files Listed:
               2 File(s)        118.268 bytes
               0 Dir(s)  322.815.311.872 bytes free

Michael Snoyman

unread,
Nov 9, 2016, 8:22:55 AM11/9/16
to kees Bleijenberg, haskell-stack
Where did you get Git from? Maybe it's mistakenly setting the files to readonly?

My guess is next step would be to create a new recursive delete function that can handle these types of file permissions.

To unsubscribe from this group and stop receiving emails from it, send an email to haskell-stack+unsubscribe@googlegroups.com.

To post to this group, send email to haskel...@googlegroups.com.

kees Bleijenberg

unread,
Nov 9, 2016, 11:57:19 AM11/9/16
to haskell-stack, mic...@snoyman.com
I uses git from https://git-scm.com/download/win. After updating, the problem remains.
git clone https://github.com/commercialhaskell/stack.git wprked flawless
Maybe this is a SSH issue?

Kees

Michael Snoyman

unread,
Nov 11, 2016, 1:02:17 AM11/11/16
to kees Bleijenberg, haskell-stack

I don't know where to go on figuring out what causes the files to be read only. But if you can write a recursive delete function that can deal with the read only files, that would be a good solution. We may also want to consider simply warning about the exception and then moving on.


kees Bleijenberg

unread,
Nov 11, 2016, 3:53:26 AM11/11/16
to haskell-stack, mic...@snoyman.com

Stéphane Laurent

unread,
Jan 22, 2017, 6:27:07 PM1/22/17
to haskell-stack
Issue open here: https://github.com/commercialhaskell/stack/issues/2423

For me this occurs when I have some github packages in stack.yaml.

Two solutions : remove git from the path, or delete the folder .stack-work/downloaded.


Reply all
Reply to author
Forward
0 new messages