[GHC] #11596: ghci gets confused if a file is deleted

#11596: ghci gets confused if a file is deleted -------------------------------------+------------------------------------- Reporter: NeilMitchell | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.0.1-rc2 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: -------------------------------------+------------------------------------- With GHC 8.0 RC2 if a currently loaded .hs file is deleted then {{{:reload}}} works, but actual execution of anything is broken. In previous versions this situation resulted in an error at {{{:reload}}} time. Below is a session that demonstrate the bug: {{{ $ ghci A.hs GHCi, version 8.0.0.20160205: http://www.haskell.org/ghc/ :? for help [1 of 2] Compiling B ( B.hs, interpreted ) [2 of 2] Compiling A ( A.hs, interpreted ) Ok, modules loaded: A, B. *A> :!cat A.hs module A where import B a = b + 1 *A> :!cat B.hs module B where b = 41 *A> :!mv B.hs B.txt *A> :r Ok, modules loaded: A. *A> :show modules A ( A.hs, interpreted ) *A> a <interactive>: fatal: cannot find object file for module `B' while linking an interpreted expression *A> :r Ok, modules loaded: A. }}} Specifically, I load A.hs, which depends on B.hs. I move B.hs away (or delete it). I reload and it says everything is fine. I try to run and it fails. Putting the B.hs file back solves it. This sequence worked fine in all previous versions of GHC, and is caught by the [https://github.com/ndmitchell/ghcid ghcid] test suite. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11596 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11596: ghci gets confused if a file is deleted -------------------------------------+------------------------------------- Reporter: NeilMitchell | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.0.1-rc2 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 thomie):
Putting the B.hs file back solves it.
This seems like an an improvement over #9648, not a regression. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11596#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11596: ghci gets confused if a file is deleted -------------------------------------+------------------------------------- Reporter: NeilMitchell | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.0.1-rc2 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 NeilMitchell):
I reload and it says everything is fine. I try to run and it fails.
Sorry, I should have been clearer - the above bit is the problem. It should complain that the module is missing when you {{{:reload}}}, rather than claiming everything is loaded correctly and failing at runtime. The fact you can recover from that state is indeed desirable, and an improvement over #9648. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11596#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11596: ghci gets confused if a file is deleted -------------------------------------+------------------------------------- Reporter: NeilMitchell | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.0.1-rc2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #11256 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by jme): * related: => #11256 Comment: I also agree that the previous behavior is preferable. Unfortunately, it appears that the change was caused by the fix for #11256. One possibility is to restore the eager reporting of missing imports only when using GHCi. Or with a little more work, only when the source file which is importing the missing module hasn't changed since the last load/reload. Thoughts? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11596#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC