atom-haskell-archive / haskell-ghc-mod

haskell-ghc-mod atom package
https://atom.io/packages/haskell-ghc-mod
MIT License
69 stars 20 forks source link

permission denied after adding elm-export to project #189

Closed KeesBleijenberg closed 7 years ago

KeesBleijenberg commented 7 years ago

I use stack and Atom. Everything is okay, until I added elm-export to the cabal and yaml file as explained in https://github.com/krisajenkins/elm-export. After I did that I get in Atom the errormessage below. After the error I close Atom and open cmd in the map of the program and do 'stack build' and I get: 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. The error occures only when I'am working with Atom. Editing with Notepad++ and building from the command line seems to work okay.

I'am using stack version 1.2.0 on windows 7 (64 bits). Haskell-ghc-mod and ghc-mod are up to date.

My first thought was, that this is a Stack error. See also: https://groups.google.com/forum/#!topic/haskell-stack/imL8dwOxZFI

Kees

Stack trace (red box in Atom) caps: {"version":[5,6,0,0],"fileMap":true,"quoteArgs":true,"optparse":true,"typeConstraints":true,"browseParents":true,"interactiveCaseSplit":true,"importedFrom":false} URI: D:\TBSchilder_1.0.3.0\source\glas\src\Glas\Commands.hs Args: -- message: Command failed: ghc-mod check D:\TBSchilder_1.0.3.0\source\glas\src\Glas\Commands.hs -- Failed to reset to commit 2a026e4c3a93a18006595636e783955223f9b98e, deleting and re-cloning. removeDirectoryRecursive: permission denied (Access is denied.) Warning: readStack: Bootstrapping stack project environment failed: readCreateProcess: D:\Users\kees\AppData\Roaming\local\bin\stack.exe "path" (exit 1): failed cabal: Cannot find the program 'ghc'. User-specified path 'ghc' does not refer to an executable and the program is not on the system path. ghc-mod: readCreateProcess: cabal "configure" "--with-ghc=ghc" "--flags" "" (exit 1): failed log: -0.579s: "Running ghc-mod check,D:\TBSchilder_1.0.3.0\source\glas\src\Glas\Commands.hs,-- with opts = ",{"cwd":"D:\TBSchilder_1.0.3.0\source\glas","env":{"ALLUSERSPROFILE":"C:\ProgramData","ANDROID_HOME":"D:\\android-sdk-windows","APPDATA":"C:\Users\kees\AppData\Roaming","ATOM_HOME":"C:\Users\kees\.atom","BDSCOMMONDIR":"C:\Users\Public\Documents\RAD Studio\5.0","CommonProgramFiles":"C:\Program Files (x86)\Common Files","CommonProgramFiles(x86)":"C:\Program Files (x86)\Common Files","CommonProgramW6432":"C:\Program Files\Common Files","COMPUTERNAME":"KEESB-PC","ComSpec":"C:\Windows\system32\cmd.exe","EICDDrive":"D:\","FP_NO_HOST_CHECK":"NO","GOOGLE_API_KEY":"AIzaSyAQfxPJiounkhOjODEO5ZieffeBv6yft2Q","HOMEDRIVE":"C:","HOMEPATH":"\Users\kees","JAVA_HOME":"d:\Program Files\Java\jdk1.7.0_79\","KMP_DUPLICATE_LIB_OK":"TRUE","LOCALAPPDATA":"C:\Users\kees\AppData\Local","LOGONSERVER":"\\KEESB-PC","MKL_SERIAL":"YES","MOZ_PLUGIN_PATH":"D:\Program Files (x86)\Foxit Software\Foxit Reader\plugins\","NODE_ENV":"production","NODE_PATH":"C:\Users\kees\AppData\Local\atom\app-1.11.2\resources\app.asar\exports","NUMBER_OF_PROCESSORS":"4","OPENSSL_CONF":"D:\Program Files\PostgreSQL\psqlODBC\etc\openssl.cnf","OS":"Windows_NT","Path":"C:\ProgramData\Oracle\Java\javapath;D:\Program Files (x86)\CodeGear\RAD Studio\5.0\bin;C:\Users\Public\Documents\RAD Studio\5.0\Bpl;c:\delphi\Delphi5\Projects\Bpl;c:\delphi\Delphi5\Bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;D:\Program Files\Git\cmd;D:\Program Files (x86)\nodejs\;D:\Program Files\TortoiseSVN\bin;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;D:\Users\kees\AppData\Roaming\local\bin;D:\Program Files (x86)\Elm Platform\0.17.1\bin;d:\OpenSSL\bin;c:\Users\kees\AppData\Roaming\local\bin;d:\Program Files\PostgreSQL\9.5\bin\;D:\gtk2\bin;C:\Program Files (x86)\Java\jre7\bin;c:\Program Files (x86)\Notepad++\;c:\Windows\twain_32\CNQ2411\;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\kees\AppData\Roaming\npm;JAVA_HOME%\bin;C:\Users\kees\AppData\Local\atom\bin;D:\mingW\bin;d:\Program Files (x86)\Elm Platform\0.17.1\bin\","PATHEXT":".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC","PROCESSOR_ARCHITECTURE":"x86","PROCESSOR_ARCHITEW6432":"AMD64","PROCESSOR_IDENTIFIER":"Intel64 Family 6 Model 58 Stepping 9, GenuineIntel","PROCESSOR_LEVEL":"6","PROCESSOR_REVISION":"3a09","ProgramData":"C:\ProgramData","ProgramFiles":"C:\Program Files (x86)","ProgramFiles(x86)":"C:\Program Files (x86)","ProgramW6432":"C:\Program Files","PSModulePath":"C:\Windows\system32\WindowsPowerShell\v1.0\Modules\","PUBLIC":"C:\Users\Public","SESSIONNAME":"Console","STACK_ROOT":"C:\sr","SystemDrive":"C:","SystemRoot":"C:\Windows","TEMP":"D:\Temp","TMP":"D:\Temp","USERDOMAIN":"keesB-PC","USERNAME":"kees","USERPROFILE":"C:\Users\kees","VBOX_MSI_INSTALL_PATH":"D:\Program Files\Oracle\VirtualBox\","VS140COMNTOOLS":"D:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\","windir":"C:\Windows","PATH":"D:\TBSchilder_1.0.3.0\source\glas\.stack-work\install\26812796\bin;C:\sr\snapshots\cae2dc39\bin;C:\ProgramData\Oracle\Java\javapath;D:\Program Files (x86)\CodeGear\RAD Studio\5.0\bin;C:\Users\Public\Documents\RAD Studio\5.0\Bpl;c:\delphi\Delphi5\Projects\Bpl;c:\delphi\Delphi5\Bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;D:\Program Files\Git\cmd;D:\Program Files (x86)\nodejs\;D:\Program Files\TortoiseSVN\bin;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;D:\Users\kees\AppData\Roaming\local\bin;D:\Program Files (x86)\Elm Platform\0.17.1\bin;d:\OpenSSL\bin;c:\Users\kees\AppData\Roaming\local\bin;d:\Program Files\PostgreSQL\9.5\bin\;D:\gtk2\bin;C:\Program Files (x86)\Java\jre7\bin;c:\Program Files (x86)\Notepad++\;c:\Windows\twain_32\CNQ2411\;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\kees\AppData\Roaming\npm;JAVA_HOME%\bin;C:\Users\kees\AppData\Local\atom\bin;D:\mingW\bin;d:\Program Files (x86)\Elm Platform\0.17.1\bin\"},"encoding":"utf-8","maxBuffer":null} -0.574s: "Running ghc-mod lint,D:\TBSchilder_1.0.3.0\source\glas\src\Glas\Commands.hs,-- with opts = ",{"cwd":"D:\TBSchilder_1.0.3.0\source\glas","env":{"ALLUSERSPROFILE":"C:\ProgramData","ANDROID_HOME":"D:\\android-sdk-windows","APPDATA":"C:\Users\kees\AppData\Roaming","ATOM_HOME":"C:\Users\kees\.atom","BDSCOMMONDIR":"C:\Users\Public\Documents\RAD Studio\5.0","CommonProgramFiles":"C:\Program Files (x86)\Common Files","CommonProgramFiles(x86)":"C:\Program Files (x86)\Common Files","CommonProgramW6432":"C:\Program Files\Common Files","COMPUTERNAME":"KEESB-PC","ComSpec":"C:\Windows\system32\cmd.exe","EICDDrive":"D:\","FP_NO_HOST_CHECK":"NO","GOOGLE_API_KEY":"AIzaSyAQfxPJiounkhOjODEO5ZieffeBv6yft2Q","HOMEDRIVE":"C:","HOMEPATH":"\Users\kees","JAVA_HOME":"d:\Program Files\Java\jdk1.7.0_79\","KMP_DUPLICATE_LIB_OK":"TRUE","LOCALAPPDATA":"C:\Users\kees\AppData\Local","LOGONSERVER":"\\KEESB-PC","MKL_SERIAL":"YES","MOZ_PLUGIN_PATH":"D:\Program Files (x86)\Foxit Software\Foxit Reader\plugins\","NODE_ENV":"production","NODE_PATH":"C:\Users\kees\AppData\Local\atom\app-1.11.2\resources\app.asar\exports","NUMBER_OF_PROCESSORS":"4","OPENSSL_CONF":"D:\Program Files\PostgreSQL\psqlODBC\etc\openssl.cnf","OS":"Windows_NT","Path":"C:\ProgramData\Oracle\Java\javapath;D:\Program Files (x86)\CodeGear\RAD Studio\5.0\bin;C:\Users\Public\Documents\RAD Studio\5.0\Bpl;c:\delphi\Delphi5\Projects\Bpl;c:\delphi\Delphi5\Bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;D:\Program Files\Git\cmd;D:\Program Files (x86)\nodejs\;D:\Program Files\TortoiseSVN\bin;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;D:\Users\kees\AppData\Roaming\local\bin;D:\Program Files (x86)\Elm Platform\0.17.1\bin;d:\OpenSSL\bin;c:\Users\kees\AppData\Roaming\local\bin;d:\Program Files\PostgreSQL\9.5\bin\;D:\gtk2\bin;C:\Program Files (x86)\Java\jre7\bin;c:\Program Files (x86)\Notepad++\;c:\Windows\twain_32\CNQ2411\;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\kees\AppData\Roaming\npm;JAVA_HOME%\bin;C:\Users\kees\AppData\Local\atom\bin;D:\mingW\bin;d:\Program Files (x86)\Elm Platform\0.17.1\bin\","PATHEXT":".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC","PROCESSOR_ARCHITECTURE":"x86","PROCESSOR_ARCHITEW6432":"AMD64","PROCESSOR_IDENTIFIER":"Intel64 Family 6 Model 58 Stepping 9, GenuineIntel","PROCESSOR_LEVEL":"6","PROCESSOR_REVISION":"3a09","ProgramData":"C:\ProgramData","ProgramFiles":"C:\Program Files (x86)","ProgramFiles(x86)":"C:\Program Files (x86)","ProgramW6432":"C:\Program Files","PSModulePath":"C:\Windows\system32\WindowsPowerShell\v1.0\Modules\","PUBLIC":"C:\Users\Public","SESSIONNAME":"Console","STACK_ROOT":"C:\sr","SystemDrive":"C:","SystemRoot":"C:\Windows","TEMP":"D:\Temp","TMP":"D:\Temp","USERDOMAIN":"keesB-PC","USERNAME":"kees","USERPROFILE":"C:\Users\kees","VBOX_MSI_INSTALL_PATH":"D:\Program Files\Oracle\VirtualBox\","VS140COMNTOOLS":"D:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\","windir":"C:\Windows","PATH":"D:\TBSchilder_1.0.3.0\source\glas\.stack-work\install\26812796\bin;C:\sr\snapshots\cae2dc39\bin;C:\ProgramData\Oracle\Java\javapath;D:\Program Files (x86)\CodeGear\RAD Studio\5.0\bin;C:\Users\Public\Documents\RAD Studio\5.0\Bpl;c:\delphi\Delphi5\Projects\Bpl;c:\delphi\Delphi5\Bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;D:\Program Files\Git\cmd;D:\Program Files (x86)\nodejs\;D:\Program Files\TortoiseSVN\bin;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;D:\Users\kees\AppData\Roaming\local\bin;D:\Program Files (x86)\Elm Platform\0.17.1\bin;d:\OpenSSL\bin;c:\Users\kees\AppData\Roaming\local\bin;d:\Program Files\PostgreSQL\9.5\bin\;D:\gtk2\bin;C:\Program Files (x86)\Java\jre7\bin;c:\Program Files (x86)\Notepad++\;c:\Windows\twain_32\CNQ2411\;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\kees\AppData\Roaming\npm;JAVA_HOME%\bin;C:\Users\kees\AppData\Local\atom\bin;D:\mingW\bin;d:\Program Files (x86)\Elm Platform\0.17.1\bin\"},"encoding":"utf-8","maxBuffer":null} -0.092s: "Got response from ghc-mod lint,D:\TBSchilder_1.0.3.0\source\glas\src\Glas\Commands.hs,--",{"stdout":"","stderr":""} -0.01s: "Failed to reset to commit 2a026e4c3a93a18006595636e783955223f9b98e, deleting and re-cloning.\r\nremoveDirectoryRecursive: permission denied (Access is denied.)\nWarning: readStack:\r\n Bootstrapping stack project environment failed: readCreateProcess: D:\Users\kees\AppData\Roaming\local\bin\stack.exe \"path\" (exit 1): failed\r\ncabal: Cannot find the program 'ghc'. User-specified path 'ghc' does not refer\r\nto an executable and the program is not on the system path.\r\nghc-mod: readCreateProcess: cabal \"configure\" \"--with-ghc=ghc\" \"--flags\" \"\" (exit 1): failed\r\n" -0.01s: "Running ghc-mod check,D:\TBSchilder_1.0.3.0\source\glas\src\Glas\Commands.hs,-- failed with ",{"killed":false,"code":1,"signal":null,"cmd":"ghc-mod check D:\TBSchilder_1.0.3.0\source\glas\src\Glas\Commands.hs --"} 0s: {"killed":false,"code":1,"signal":null,"cmd":"ghc-mod check D:\TBSchilder_1.0.3.0\source\glas\src\Glas\Commands.hs --"} Show Stack Trace

lierdakil commented 7 years ago

Sorry about the late reply, I didn't have much time to read this through.

If I had to guess, stack bootstrapping fails horribly due to a race condition. If I'm right, then enabling 'Low Memory System' option in haskell-ghc-mod should help (at the cost of much slower startup times)

KeesBleijenberg commented 7 years ago

More investigations showed that the git-files are read-only after the error. The files are in the ....stack-work\downloaded\7A15yVYjrQP7.git\objects\pack\ directory. Stack fails because it can't remove the read-only files

lierdakil commented 7 years ago

Well, again, I'm not a stack developer, and nothing but stack touches those files. But as far as I can tell, this issue is exclusive to ide-haskell.

So, I'm guessing the following: In some cases, ghc-mod will launch stack bootstrapper. And haskell-ghc-mod will run several ghc-mod processes in parallel to decrease startup times and increase overall responsiveness (at the cost of higher cpu and memory usage, obviously). Stack bootstrapper has been known to cause some problems when started in parallel. There's a patch in ghc-mod master branch that should help with this, but I have no release date.

Bear in mind, this is pure guesswork, but again, if I'm right, enabling 'Low Memory System' option in haskell-ghc-mod should help, since it will force single-threaded operation, which will sidestep the whole parallel issue. Should be easy enough to check if it's true. That's not a solution, but a workaround. But I don't have other ideas that don't involve brittle crutches and horrible hacks, sorry.

lierdakil commented 7 years ago

Closing due to lack of activity. If experiencing similar problems, please open new issues.