[GHC] #12927: Colorized error messages result in hard-to-read .dump-* files
#12927: Colorized error messages result in hard-to-read .dump-* files -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Other Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: #8809 Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- To see this, compile this file: {{{#!hs module Main where x :: String -> String x s = print (reverse s + 1) }}} with `ghc-stage2 -ddump-tc-trace -ddump-to-file`. If you look at the resulting `.dump-tc-trace` file with a text editor like `vim`, you'll see at the bottom: {{{ ... Tc7a checkMain fail Main main Adding error: ^[[;1mBug.hs:1:1: ^[[;1m^[[31merror:^[[;1m The IO action ‘main’ is not defined in module ‘Main’^[[0m }}} The error message is now much harder to discern that before the introduction of colorized error messages. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12927> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12927: Colorized error messages result in hard-to-read .dump-* files -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: #8809 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by ezyang): As a workaround, you can use `less -r` to pass the color codes directly on to your terminal. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12927#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12927: Colorized error messages result in hard-to-read .dump-* files -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: #8809 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Rufflewind): Another workaround would be to pass `-fdiagnostics-color=never` to ghc. I think the right fix would be to not output ANSI color codes except when the destination is stderr. It's a bit tricky though because I'm not sure how to detect this from within `mkLocMessageAnn`. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12927#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12927: Colorized error messages result in hard-to-read .dump-* files -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: #8809 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Rufflewind): Hope this fixes it: https://phabricator.haskell.org/D2792 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12927#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12927: Colorized error messages result in hard-to-read .dump-* files -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: #8809 | Differential Rev(s): Phab:D2792 Wiki Page: | -------------------------------------+------------------------------------- Changes (by Phyx-): * status: new => patch * differential: => Phab:D2792 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12927#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12927: Colorized error messages result in hard-to-read .dump-* files -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: #8809 | Differential Rev(s): Phab:D2792 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"cee72d5c3c53863bd4fc9f324a93c322448e038e/ghc" cee72d5/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="cee72d5c3c53863bd4fc9f324a93c322448e038e" Disable colors unless printing to stderr Only print colors when mkLocMessageAnn is called directly from defaultLogAction. This prevents ANSI error codes from cluttering up the dump files. Test Plan: validate Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2792 GHC Trac Issues: #12927 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12927#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12927: Colorized error messages result in hard-to-read .dump-* files -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: #8809 | Differential Rev(s): Phab:D2792 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed * milestone: => 8.2.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12927#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC