[GHC] #14097: -ddump-json doesn't interact as expected with -ddump-to-file

#14097: -ddump-json doesn't interact as expected with -ddump-to-file -------------------------------------+------------------------------------- Reporter: mpickering | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Keywords: JSON | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Usually with dump flags, if you set `ddump-to-file` then the dumped file will be outputted in the current directory if `-dumpdir` or `-ddump-file- prefix` is not set. This doesn't work with `-ddump-json`, if you do not specify `-ddump-file-prefix` then the output is always on stdout. Clearly stated, here are the two problems which I think have the same solution. 1. `-ddump-to-file -ddump-json` should output a file in the currect directory. 2. `-ddump-to-file -ddump-json` does not respect `-dumpdir` It seems that a stale set of DynFlags is used to direct the output of `-ddump-json`. The relevant function is `DynFlags.jsonLogFinaliser`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14097 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14097: -ddump-json doesn't interact as expected with -ddump-to-file -------------------------------------+------------------------------------- Reporter: mpickering | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: JSON 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 mpickering): The problem is that `dumpPrefix` is set in DriverPipeline but then this modified version of `DynFlags` is not propagated outwards and so it is not set at the time `jsonLogFinaliser` calls `dumpSDoc`. This means that `chooseDumpFile` fails as `dumpPrefix` is not set and the output is instead forwarded onto stdout. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14097#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14097: -ddump-json doesn't interact as expected with -ddump-to-file -------------------------------------+------------------------------------- Reporter: mpickering | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: JSON 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 mpickering): There is quiet a fundamental problem that even if we propagate this information outwards, functions like `parUpsweep_one` operate in IO, on an exception this means that the updated dflags are not set and the output it still printed on stdout. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14097#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14097: -ddump-json doesn't interact as expected with -ddump-to-file -------------------------------------+------------------------------------- Reporter: mpickering | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: JSON 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 mpickering): Well, the real problem here is that the way things are currently engineered, `-ddump-json` collects error messages for the entire compilation and then dumps them in one go. `dumpSDoc` is set up to dump things on a per-module basis, as such the log files are given the name of the current module they are dumping. Perhaps a better design for `-ddump- json` would be to output a JSON log on a module-by-module basis rather than collecting all the output. This would complicate the implementation a little as the messages would need to be sorted by module. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14097#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC