[GHC] #12180: Ctrl-c during build produces *some* outputs for a file, and GHC --make fails handling this

GHC ghc-devs at haskell.org
Fri Jun 10 13:36:19 UTC 2016


#12180: Ctrl-c during build produces *some* outputs for a file, and GHC --make
fails handling this
--------------------------------------+---------------------------------
           Reporter:  Blaisorblade    |             Owner:
               Type:  bug             |            Status:  new
           Priority:  low             |         Milestone:
          Component:  Driver          |           Version:  7.10.3
           Keywords:                  |  Operating System:  MacOS X
       Architecture:  x86_64 (amd64)  |   Type of failure:  None/Unknown
          Test Case:                  |        Blocked By:
           Blocking:                  |   Related Tickets:
Differential Rev(s):                  |         Wiki Page:
--------------------------------------+---------------------------------
 This is a minor issue, but after I interrupted and restarted `stack build
 --ghc-options=-j3` (went from `stack build` to `stack build --ghc-
 options=-j2` to -j3), I ended up with a build that did not complete.

     clang: error: no such file or directory: '.stack-
 work/dist/x86_64-osx/Cabal-1.22.5.0/build/Agda/TypeChecking/SizedTypes.dyn_o'

 Doing `stack build` again did not fix the issue. I assume this is due to
 the underlying `ghc --make`.

 Apparently, only some of the compiled output files were written, not all
 (see below), but GHC (I guess) assumes they're created atomically. Worse,
 the `.dyn_hi` variant existed but `.dyn_o` was missing. After removing all
 of them, restarting the build completed successfully.

 Fixes could include creating the files atomically or assuming that might
 not happen; since creating multiple files together atomically is
 impossible (the rename trick doesn't handle this, even ignoring its
 limitations), the 2nd option appears more sensible.

 While this was easy for me, most compilers avoid this, and I'm sure some
 users would be a bit more confused in this scenario—it's easy to imagine
 this happening to students.

 Listing of relevant build products:
 {{{
 $ ls .stack-
 work/dist/x86_64-osx/Cabal-1.22.5.0/build/Agda/TypeChecking/SizedTypes.*
 .stack-
 work/dist/x86_64-osx/Cabal-1.22.5.0/build/Agda/TypeChecking/SizedTypes.dyn_hi
 .stack-
 work/dist/x86_64-osx/Cabal-1.22.5.0/build/Agda/TypeChecking/SizedTypes.hi
 .stack-
 work/dist/x86_64-osx/Cabal-1.22.5.0/build/Agda/TypeChecking/SizedTypes.o
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12180>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list