failed while unpacking the package - windows #1698

Closed
luite opened this Issue Feb 22, 2014 · 15 comments

Projects

None yet

10 participants

@luite
Member
luite commented Feb 22, 2014

installing haskell-src-exts-1.14.0.1 fails with the cabal master on windows 8.1 (tested with ghc 7.6.3 and 7.8.1rc1 i386), i suspect because this package contains a dist directory (with a pre-generated happy parser)

bash.exe"-3.1$ cabal install -v -j1 haskell-src-exts-1.14.0.1
Reading available packages...
Choosing modular solver.
Resolving dependencies...
Ready to install haskell-src-exts-1.14.0.1
Waiting for install task to finish...
Extracting
C:\Users\luite\AppData\Roaming\cabal\packages\hackage.haskell.org\haskell-src-ex
ts\1.14.0.1\haskell-src-exts-1.14.0.1.tar.gz
to C:\Users\luite\AppData\Local\Temp\haskell-src-exts-1.14.0.1-3704...
creating
C:\Users\luite\AppData\Local\Temp\haskell-src-exts-1.14.0.1-3704\haskell-src-ext
s-1.14.0.1\dist
Failed to install haskell-src-exts-1.14.0.1
World file is already up to date.
cabal.exe: Error: some packages failed to install:
haskell-src-exts-1.14.0.1 failed while unpacking the package. The exception
was:
C:\Users\luite\AppData\Local\Temp\haskell-src-exts-1.14.0.1-3704\haskell-src-ext
s-1.14.0.1\dist-tmp:
MoveFileEx
"C:\\Users\\luite\\AppData\\Local\\Temp\\haskell-src-exts-1.14.0.1-3704\\haskell
-src-exts-1.14.0.1\\dist-tmp"
"C:\\Users\\luite\\AppData\\Local\\Temp\\haskell-src-exts-1.14.0.1-3704\\haskell
-src-exts-1.14.0.1\\dist":
permission denied (Access is denied.)
@ghost
ghost commented May 1, 2014

I am also experiencing this for haddock.

Doing this:

cabal install haddock --constraint=haddock==2.13.2.1

gives me this:

Resolving dependencies...
Failed to install haddock-2.13.2.1
cabal: Error: some packages failed to install:
haddock-2.13.2.1 failed while unpacking the package. The exception was:
C:\Users\Edwin\AppData\Local\Temp\haddock-2.13.2.1-3624\haddock-2.13.2.1\dist-tmp:
MoveFileEx
"C:\\Users\\Edwin\\AppData\\Local\\Temp\\haddock-2.13.2.1-3624\\haddock-2.13.2.1\\dist-tmp"
"C:\\Users\\Edwin\\AppData\\Local\\Temp\\haddock-2.13.2.1-3624\\haddock-2.13.2.1\\dist":
permission denied (Access is denied.)
@andersarpi

I'm getting the exact same messages for the exact same packages.

Also running GHC 7.6.3 on Windows 8.1.

@voland62
voland62 commented May 9, 2014

Same for me, but with language-c-0.4.5 package

@romhack
romhack commented May 10, 2014

Same here with pandoc-citeproc 0.3.1, which does not let me install hakyll. Windows 7.
For same newbies, as me, the workaround can be installing your package manually, and then continuing normal cabal install procedure.

@anton-dessiatov

Just wanted to report that I also see this bug with GHC 7.8.2 on Windows 2012 server. I couldn't install happy-1.19.3 and language-c-0.4.5. After extracting and installing these packages tar.gz contents manually everything worked fine.

@anton-dessiatov

Here is the log with --verbosity=3

Ready to install alex-3.1.3
Waiting for install task to finish...
Extracting
C:\Users\build\AppData\Roaming\cabal\packages\hackage.haskell.org\alex\3.1.3\alex-3.1.3.tar.gz
to C:\Users\build\AppData\Local\Temp\1\alex-3.1.3-736...
Renaming 'C:\Users\build\AppData\Local\Temp\1\alex-3.1.3-736\alex-3.1.3\dist'
to 'C:\Users\build\AppData\Local\Temp\1\alex-3.1.3-736\alex-3.1.3\dist-tmp'.
creating C:\Users\build\AppData\Local\Temp\1\alex-3.1.3-736\alex-3.1.3\dist
Renaming
'C:\Users\build\AppData\Local\Temp\1\alex-3.1.3-736\alex-3.1.3\dist-tmp' to
'C:\Users\build\AppData\Local\Temp\1\alex-3.1.3-736\alex-3.1.3\dist'.
Failed to install alex-3.1.3
World file is already up to date.
cabal.exe: Error: some packages failed to install:
alex-3.1.3 failed while unpacking the package. The exception was:
C:\Users\build\AppData\Local\Temp\1\alex-3.1.3-736\alex-3.1.3\dist-tmp:
MoveFileEx
"C:\\Users\\build\\AppData\\Local\\Temp\\1\\alex-3.1.3-736\\alex-3.1.3\\dist-tmp"
"C:\\Users\\build\\AppData\\Local\\Temp\\1\\alex-3.1.3-736\\alex-3.1.3\\dist":
permission denied (Access is denied.)

Looks like the presense of dist directory in the tar.gz makes cabal rename it to dist-tmp, then create it one more time and then fail trying to rename dist-tmp back to dist.

@kosiakk
kosiakk commented May 13, 2014

It is possible to install Pandoc without any conflicts from Git clone using 'cabal install'. So the problem seems to be related to the package, not really the code itself.

@stephensong

Any suggested workarounds for this? I didn't really understand kosiakk's reference to cabal install from Git clone.

@anton-dessiatov

@stephensong You may just clone Pandoc source from git (or download a recent tarball from Hackage and extract it to any folder you like) manually, and then launch cabal install from a directory that contains a source code.

I haven't tried that with Pandoc, but it works for me with packages like alex, happy, and language-c.

@stephensong

Thanks for responding, Anton.

I tried your suggestion firstly with Alex, and it failed saying that it
needed happy. So I then tried it with happy ... and it failed thusly:

[17:07:20] $ cabal install
Resolving dependencies...
[1 of 1] Compiling Main ( dist\setup\setup.hs,
dist\setup\Main.o )
Linking .\dist\setup\setup.exe ...
Configuring happy-1.19.3...
Building happy-1.19.3...
Preprocessing executable 'happy' for happy-1.19.3...
setup.exe: The program 'happy' is required but it could not be found
Failed to install happy-1.19.3
cabal.exe: Error: some packages failed to install:
happy-1.19.3 failed during the building phase. The exception was:
ExitFailure 1

Wtf? I have to have happy to build happy?

In desperation, I then reinstalled the entire Haskell Platform, and
realised that I had been missing a requisite search path to extralibs.
Everything seems to be working fine now - managed to install Hakyll (and
PanDoc) with no problems whatsoever (afaict).

Thanks again for your help.

gary

On 16/06/2014 6:03 PM, Anton Dessiatov wrote:

@stephensong https://github.com/stephensong You may just clone
Pandoc source from git (or download a recent tarball from Hackage and
extract it to any folder you like) manually, and then launch cabal
install from a directory that contains a source code.

I haven't tried that with Pandoc, but it works for me with packages
like alex, happy, and language-c.


Reply to this email directly or view it on GitHub
#1698 (comment).

@RyanGlScott
Member

Interestingly, this error only arises for me if I try running %APPDATA%\cabal\bin\cabal.exe (i.e., the version installed by cabal install cabal-install). If I run C:\Program Files (x86)\Haskell Platform\2013.2.0.0\lib\extralibs\bin\cabal.exe, then installation works fine. This leads me to believe that there's some sort of special permissions that Windows is giving the latter cabal.exe, but I can't seem to elevate the former cabal.exe's permissions. I have tried:

  • Right-clicking PowerShell and Cygwin and running them as Administrator
  • Right-clicking %APPDATA%\cabal\bin\cabal.exe, clicking Properties, going to the Security tab, clicking Advanced, going to the Owner tab, clicking Edit, and changing the Owner to Administrators.

Neither seemed to change anything.

@23Skidoo
Member

@RyanGlScott If the cabal-install exe in %APPDATA%\cabal\bin\ is a newer version, then it's probably a regression.

@RyanGlScott
Member

@23Skidoo You're right. The Haskell Platform version of cabal-install is 1.16.0.2. I also tried installing haskell-src-exts with cabal-install-1.18.0.4 and it worked, but installing it with cabal-install-1.20.0.0 yields the above errors.

@sardonicpresence

I suspect this is due to the createDirectoryIfMissing call at Install.hs line 1200. According to the function documentation renameDirectory fails on Windows if the destination already exists, which this guarantees if distDirPath and distDirPathNew are the same.

As such, a simple fix might be to ensure that the old & new dist paths differ in the preceding when in which case no action is required anyway: pull request.

@23Skidoo
Member

Should be fixed by #1698 and 5c46e78. Please reopen if the bug still occurs.

@23Skidoo 23Skidoo closed this Jun 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment