[GHC] #9395: Debug.Trace should not use %s for format string

GHC ghc-devs at haskell.org
Wed Feb 18 15:47:57 UTC 2015


#9395: Debug.Trace should not use %s for format string
-------------------------------------+-------------------------------------
        Reporter:  ezyang            |                   Owner:  ezyang
            Type:  bug               |                  Status:  closed
        Priority:  normal            |               Milestone:
       Component:  Core Libraries    |                 Version:  7.8.2
      Resolution:  fixed             |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by Austin Seipp <austin@…>):

 In [changeset:"a82364c9410d35fa9cb5031d553212267c3628c5/ghc"]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="a82364c9410d35fa9cb5031d553212267c3628c5"
 Don't truncate traceEvents to 512 bytes (#8309)

 Summary:
 Don't call postLogMsg to post a user msg, because it truncates messages to
 512 bytes.

 Rename traceCap_stderr and trace_stderr to vtraceCap_stderr and
 trace_stderr,
 to signal that they take a va_list (similar to vdebugBelch vs debugBelch).

 See #3874 for the original reason behind traceFormatUserMsg.

 See the commit msg in #9395 (d360d440) for a discussion about using
 null-terminated strings vs strings with an explicit length.

 Test Plan:
 Run `cabal install ghc-events` and inspect the result of `ghc-events show`
 on
 an eventlog file created with `ghc -eventlog Test.hs` and `./Test +RTS
 -l`,
 where Test.hs contains:

 ```
 import Debug.Trace
 main = traceEvent (replicate 510 'a' ++ "bcd") $ return ()
 ```

 Depends on D655.

 Reviewers: austin

 Reviewed By: austin

 Subscribers: thomie

 Differential Revision: https://phabricator.haskell.org/D656

 GHC Trac Issues: #8309
 }}}

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


More information about the ghc-tickets mailing list