sol / hpack

hpack: A modern format for Haskell packages
MIT License
623 stars 103 forks source link

Can't build on windows - 1 test fails on updated resolver #545

Closed theGhostJW closed 1 year ago

theGhostJW commented 1 year ago

I managed to compile by bumping everything to the latest stack resolver at the time.

https://github.com/sol/hpack/pull/544

I have one issue with running tests as described in the MR:


hello, I could not compile master on windows. stack build was failing with an access violation. I tried cabal build but failed with type errors.

So I tried a Hail Mary ditch constraints and and bump the resolver to Stackage Nightly 2023-02-23 (ghc-9.4.4) on my windows machine stack build succeeds and all but 1 test pass when stack test is run

Failures:

  test\HpackSpec.hs:55:40: 
  1) Hpack.renderCabalFile is inverse to readCabalFile
       expected: ["../../hpack.cabal"]
        but got: ["../../hpack.cabal", "-- This file has been generated from package.yaml by hpack.", "--", "-- see: https://github.com/sol/hpack", ""]

  To rerun use: --match "/Hpack/renderCabalFile/is inverse to readCabalFile/"

Randomized with seed 927868982

Finished in 11.7191 seconds
546 examples, 1 failure, 3 pending

I suspect this test is failing because expected is wrong? the test is:

  describe "renderCabalFile" $ do
    it "is inverse to readCabalFile" $ do
      expected <- lines <$> readFile "resources/test/hpack.cabal"
      Just c <- readCabalFile "resources/test/hpack.cabal"
      renderCabalFile "package.yaml" c `shouldBe` expected

the content of resources/test/hpack.cabal is:

../../hpack.cabal

Does readFile somehow follow this link in other OSs and just return the content on windows?

sol commented 1 year ago

This is a git + windows question and unrelated to Hpack. Try to search for "git windows symlinks" to find an answer to your question.

theGhostJW commented 1 year ago

@sol I take it you mean for the failing tests after I bumped the resolver, is the build failure on windows related? The only reason i was running the tests was I needed to bump the resolver to get the build to pass. The error was:

PS C:\hpack> stack build
asn1-types     > configure
asn1-types     > Configuring asn1-types-0.3.4...
asn1-types     > 
asn1-types     > Access violation in generated code when writing 0x0
asn1-types     > 
asn1-types     >  Attempting to reconstruct a stack trace...
asn1-types     > 
asn1-types     >    Frame       Code address
asn1-types     >  * 0x461da80   0x37f7b66 C:\Users\thegh\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x33f7b66
asn1-types     >  * 0x461da88   0x3277bb9 C:\Users\thegh\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x2e77bb9
asn1-types     >  * 0x461da90   0x5
asn1-types     >  * 0x461da98   0x5
asn1-types     >  * 0x461daa0   0x3d7dc22 C:\Users\thegh\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x397dc22
asn1-types     >  * 0x461daa8   0x67c4dc0
asn1-types     > 
text-metrics   > configure 
text-metrics   > Configuring text-metrics-0.3.0...
text-metrics   >
text-metrics   > Access violation in generated code when writing 0x0
text-metrics   >
text-metrics   >  Attempting to reconstruct a stack trace...
text-metrics   >
text-metrics   >    Frame       Code address
text-metrics   >  * 0x461da80   0x37f7b66 C:\Users\thegh\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x33f7b66
text-metrics   >  * 0x461da88   0x3277bb9 C:\Users\thegh\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x2e77bb9
text-metrics   >  * 0x461da90   0x5
text-metrics   >  * 0x461da98   0x5
text-metrics   >  * 0x461daa0   0x3d7dc22 C:\Users\thegh\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x397dc22
text-metrics   >  * 0x461daa8   0x66c4dc0
text-metrics   >
Progress 2/13
theGhostJW commented 1 year ago

@sol please ignore the above - I see now you have made a separate fix - thanks!!!