[GHC] #14188: On windows, trace prints out lines without proper line endings
#14188: On windows, trace prints out lines without proper line endings -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 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: -------------------------------------+------------------------------------- Try this on Windows {{{ module Foo where f x = x }}} and now {{{ ghc -c -dverbose-core2core Foo.hs 2> foo }}} Now edit `foo`. You'll see that * Some lines, produced by monadic IO, I think, have CRLF endings (`^M^J`). * But others, produced by `pprTrace` (actually `Simplify.hs` line 220, only have a LF ending (`^J`). The inconsistent line endings confuses emacs, which displays `^M` at the end of all the CRLF lines (ie most of them). This is Jolly Annoying. John Wiegley has made me a special SPJ-only emacs mimor mode that suppresses the annoying `^M` stuff, but that seems like extreme measures. Question: why doesn't `pprTrace` properly terminate its lines? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14188> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14188: On windows, trace prints out lines without proper line endings ---------------------------------+---------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by RyanGlScott): * os: Unknown/Multiple => Windows -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14188#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14188: On windows, trace prints out lines without proper line endings ---------------------------------+---------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4018 Wiki Page: | ---------------------------------+---------------------------------------- Changes (by Phyx-): * status: new => patch * differential: => Phab:D4018 * milestone: => 8.4.1 Comment: Something seems to be setting `stderr` in binary mode when `traceIO` is called. stuff written via the Haskell I/O manager seems to correct the mode before printing. So I'm doing the same in the C code now. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14188#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14188: On windows, trace prints out lines without proper line endings ---------------------------------+---------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4018 Wiki Page: | ---------------------------------+---------------------------------------- Comment (by Tamar Christina <tamar@…>): In [changeset:"2b2595e03d328f8c49afe55f765635c03dc81865/ghc" 2b2595e0/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="2b2595e03d328f8c49afe55f765635c03dc81865" Ensure text mode when calling debug functions Summary: Something seems to be changing stderr into binary mode, so when the `traceIO` is called, the C code that ultimately calls `vfprintf` is using a binary mode handle. This causes newlines not to be encoded properly. The patch ensures we're in text mode when writing the debug messages (% interleaving as it's not thread safe at all) and restores the previous mode when done. I'm slightly concerned about the performance implications of writing large dumps out in text mode, but I think the current behavior is not intended as I cannot see any of the printing code setting the mode of the std handles. Test Plan: ./validate Reviewers: austin, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #14188 Differential Revision: https://phabricator.haskell.org/D4018 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14188#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14188: On windows, trace prints out lines without proper line endings ---------------------------------+---------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.2.1 Resolution: fixed | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4018 Wiki Page: | ---------------------------------+---------------------------------------- Changes (by Phyx-): * status: patch => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14188#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC