[GHC] #14862: Switching to Cabal 2.2 makes ghc unusable

#14862: Switching to Cabal 2.2 makes ghc unusable -------------------------------------+------------------------------------- Reporter: alpmestan | Owner: (none) Type: bug | Status: new Priority: high | Milestone: Component: None | Version: 8.4.1-alpha3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- When bumping Cabal to 2.2 as done [https://phabricator.haskell.org/D4453 here], we end up with a stage 1 GHC that seemingly cannot build a non- segfaulting program. For instance, if one builds the following trivial program with a stage 1 built from the ghc-8.4 branch + the patch above... {{{#!hs import System.Exit main = exitSuccess }}} Then... {{{#!sh $ ./foo Segmentation fault }}} So of course, when we proceed and build stage 2, and then build things with stage 2, all the stage2 commands crash. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14862 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14862: Switching to Cabal 2.2 makes ghc unusable -------------------------------------+------------------------------------- Reporter: alpmestan | Owner: (none) Type: bug | Status: new Priority: high | Milestone: Component: None | Version: 8.4.1-alpha3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by refold): Can you try bisecting to find the offending Cabal commit? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14862#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14862: Switching to Cabal 2.2 makes ghc unusable -------------------------------------+------------------------------------- Reporter: alpmestan | Owner: (none) Type: bug | Status: new Priority: high | Milestone: Component: None | Version: 8.4.1-alpha3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by hvr): * cc: angerman (added) Comment: Additional infos: It's unrelated to `integer-gmp` (I was able to reproduce this with an integer-simple-based GHC build as well); so this leaves `rts`, `ghc-prim` or `base` being possibly miscompiled (wrong/missing compile settings or include headers) due to something that wasn't accounted for in phab:D4453. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14862#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14862: Switching to Cabal 2.2 makes ghc unusable -------------------------------------+------------------------------------- Reporter: alpmestan | Owner: alpmestan Type: bug | Status: new Priority: high | Milestone: Component: None | Version: 8.4.1-alpha3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by alpmestan): * owner: (none) => alpmestan Comment: refold: most of us suspect the "basedir" PR, I'm trying all sorts of things from gdb/rr to figure out how even that trivial program ends up crashing. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14862#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14862: Switching to Cabal 2.2 makes ghc unusable -------------------------------------+------------------------------------- Reporter: alpmestan | Owner: alpmestan Type: bug | Status: new Priority: high | Milestone: Component: None | Version: 8.4.1-alpha3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by alpmestan): Alright, so gdb hasn't been all that helpful as it seems that single- stepping somehow makes me follow a codepath that just loops between the scheduler and the top of the haskell stack without really ever making progress. I have not managed to find a breakpoint that's "far enough" so that single-stepping would just lead me right to the crash. However, in the meantime hvr saw that: {{{#!hs import Data.Typeable data Foo = Foo deriving Eq data Bar = Bar deriving Eq main = print (Just Foo == cast Bar) }}} prints `True`, while it should obviously crash (because we'd expect `cast` to return `Nothing` here). What's more: {{{#!hs *Main Data.Typeable λ> typeRepFingerprint (typeRep (Proxy :: Proxy Foo)) 00000000000000000000000000000000 *Main Data.Typeable λ> typeRepFingerprint (typeRep (Proxy :: Proxy Bar)) 00000000000000000000000000000000 }}} hvr and I then looked at the code that generates those fingerprints. We end up calling `fingerprintFingerprints` for both, so I added a `print` to `fingerprintFingerprints` to see what the inputs to the fingerprinting code are in both cases. After digging some more for a while, we ended up realizing that `SIZEOF_STRUCT_MD5CONTEXT` is detected to be... 0! Which cause the md5 context & the digest to overlap in memory, and since we memset the md5 context to 0 at the end of the md5 computation in the C code, we end up with an all-0 digest, whatever the inputs! hvr has reported a fix in [https://phabricator.haskell.org/D4453#123717 the aforementionned diff]. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14862#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14862: Switching to Cabal 2.2 makes ghc unusable -------------------------------------+------------------------------------- Reporter: alpmestan | Owner: alpmestan Type: bug | Status: new Priority: high | Milestone: Component: None | Version: 8.4.1-alpha3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): Let's add the case in comment:4 as a testcase if there isn't already something similar; it seems like a very reasonable sanity-check. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14862#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14862: Switching to Cabal 2.2 makes ghc unusable -------------------------------------+------------------------------------- Reporter: alpmestan | Owner: angerman Type: bug | Status: new Priority: high | Milestone: Component: None | Version: 8.4.1-alpha3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by alpmestan): * owner: alpmestan => angerman Comment: Moritz is looking into the few small quirks left to handle for [https://phabricator.haskell.org/D4453 D4453] to be mergeable. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14862#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14862: Switching to Cabal 2.2 makes ghc unusable -------------------------------------+------------------------------------- Reporter: alpmestan | Owner: angerman Type: bug | Status: closed Priority: high | Milestone: Component: None | Version: 8.4.1-alpha3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by alpmestan): * status: new => closed * resolution: => fixed Comment: [https://phabricator.haskell.org/D4453 D4453] has been merged. Thanks hvr/angerman! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14862#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC