Download Expectation Failure for SHA dependency

37 views
Skip to first unread message

Justin Blank

unread,
Dec 28, 2015, 12:56:29 PM12/28/15
to haskell-stack
I'm receiving the following error when running stack build, and I'm not sure whether it reflects something wrong with my configuration or stack, or Stackage. Can anyone give me guidance on where to look?

Download expectation failure: content hash (SHA512)
Expected: aa1178f08ad3364c504ee790dac9b0774b7461fa7ea0a8f2c3ad82943d109602debcf4a8a83090815fef487ceac40019f8b5594ab0043f36e019d69bc5f76853 (ByteString)
Actual:   91f514e1731ef3c2063ff5ab6156242755b2b2b462d4a1f40f150d96cf714f7b7b5b19c7705e5129bbb9876216ca86ff52e49cd7604d83e4b4150172c9bda228

I'm running windows 7, 32-bit, with 
Stack Version 0.1.10.1, Git revision 83ec40fc5fd6d300c73d23deb1f41d30168fc236 (2783 commits) i386

I created the project by running 
stack new downloadtest simple

and adding 
SHA
to build-depends. 

My cabal file:

name:                downloadtest
version:             0.1.0.0
synopsis:            Simple project template from stack
description:         Please see README.md
license:             BSD3
license-file:        LICENSE
author:              Author name here
maintainer:          exa...@example.com
copyright:           2010 Author Here
category:            Web
build-type:          Simple
cabal-version:       >=1.10

executable downloadtest
  hs-source-dirs:      src
  main-is:             Main.hs
  default-language:    Haskell2010
  build-depends:       base >= 4.7 && < 5
                       , SHA

Michael Snoyman

unread,
Dec 29, 2015, 1:10:53 AM12/29/15
to Justin Blank, haskell-stack
This shouldn't be necessary, but can you try deleting the SHA tarball inside your stack directory? It should be at:

    %APPDATA%\stack\indices\Hackage\packages\SHA\1.6.4.2\SHA-1.6.4.2.tar.gz

If this fixes things, then we need to add some logic to Stack to automatically delete corrupted downloads (logic I thought was already present).

--
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.
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/d6e3720a-743c-4704-b0bd-f2d7ebd30c43%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dan Burton

unread,
Dec 29, 2015, 4:21:34 AM12/29/15
to Michael Snoyman, Justin Blank, haskell-stack
Download expectation failure: content hash

This message comes from the WrongDigest exception. It appears to me that this is being thrown because your download is legitimately (and repeatedly?) corrupted. Is there a proxy messing with your download or something?

Here's the code path for checking for corrupted downloads:


getShouldDownload -- calls
fileMatchesExpectations -- calls (and catches WrongDigest :: VerifiedDownloadException)
hashChecksToZipSink -- calls
sinkCheckHash -- throws WrongDigest

I don't think the exception is being printed out from this code path, because on this code path the WrongDigest exception is caught rather than being allowed to propagate to the top.

(I've manually downloaded the file in question and can confirm that it has the expected sha512.)

Here's a test case that claims to demonstrate that an existing incorrect file will be replaced with the correct downloaded file:


-- Dan Burton

Dan Burton

unread,
Dec 29, 2015, 4:24:19 AM12/29/15
to Michael Snoyman, Justin Blank, haskell-stack

On Tue, Dec 29, 2015 at 1:21 AM, Dan Burton <danburt...@gmail.com> wrote:
Here's the code path for checking for corrupted downloads:

What I meant to say was, "Here's the code path for checking for corrupted exiting files."

-- Dan Burton

Dan Burton

unread,
Dec 29, 2015, 4:39:57 AM12/29/15
to Michael Snoyman, Justin Blank, haskell-stack
This actually sounds very similar to an issue Michael had a long time ago:


We had a hard time reproducing it then, and I presume the same might be true of this case as well. Maybe that means there really is a bug in there somewhere.

-- Dan Burton

Justin Blank

unread,
Dec 29, 2015, 9:38:23 AM12/29/15
to haskell-stack, mic...@snoyman.com
Thanks a lot--after deleting the file, a subsequent stack build worked. 

I should note that in my case, the file is under C:/stack_root, not the AppData folder.

I retained the SHA-1.6.4.2.tar.gz file for comparison, just in the off chance that it is helpful (but I assume a synthetic test case would be easy enough to produce). Let me know if there is any other information I can provide that would be relevant to a bug fix.

Dan Burton

unread,
Dec 29, 2015, 5:17:48 PM12/29/15
to Justin Blank, haskell-stack, mic...@snoyman.com
A few questions if you have the time.

Did you check with an outside tool that the corrupt file had the "actual" sha512 as reported by stack?

Can you reproduce the problem by copying the corrupt file back to where it was?

For more options, visit https://groups.google.com/d/optout.


--
-- Dan Burton

Michael Snoyman

unread,
Dec 30, 2015, 5:26:22 AM12/30/15
to Dan Burton, Justin Blank, haskell-stack
I was just able to reproduce this problem by changing a few bytes inside the file, but keeping the file the same size. I'll see about a patch to fix that.

Michael Snoyman

unread,
Dec 30, 2015, 5:49:20 AM12/30/15
to Dan Burton, Justin Blank, haskell-stack
I think this is now resolved on master with:


You can try `stack upgrade --git` to test out the change.
Reply all
Reply to author
Forward
0 new messages