[GHC] #9395: Debug.Trace should not use %s for format string
GHC
ghc-devs at haskell.org
Tue Aug 5 17:51:17 UTC 2014
#9395: Debug.Trace should not use %s for format string
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner: ezyang
Type: bug | Status: new
Priority: normal | Milestone:
Component: | Version: 7.8.2
libraries/base | Keywords:
Resolution: | Architecture: Unknown/Multiple
Operating System: | Difficulty: Unknown
Unknown/Multiple | Blocked By:
Type of failure: Incorrect | Related Tickets:
result at runtime |
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by Edward Z. Yang <ezyang@…>):
In [changeset:"d360d440b994c03d645603c50f25ef208700db02/ghc"]:
{{{
#!CommitTicketReference repository="ghc"
revision="d360d440b994c03d645603c50f25ef208700db02"
Filter out null bytes from trace, and warn accordingly, fixing #9395.
Summary:
Previously, if you ran trace "foo\0bar", the output was truncated so
that everything after the null byte was omitted. This was terrible.
Now we filter out null bytes, and emit an extra trace saying that
null bytes were filtered out.
NB: we CANNOT fix debugBelch, because all printf variants *always*
respect null bytes, even if you're using string precision such as
%.*s. The alternative would have been to introduce a new function
debugRawBelch which did not use format strings and took an explicit
string length, but I decided we generally should avoid putting null
bytes in our trace messages, and warn the user.
Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>
Test Plan: validate
Reviewers: hvr, austin
Subscribers: simonmar, relrod, ezyang, carter
Differential Revision: https://phabricator.haskell.org/D121
GHC Trac Issues: #9395
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9395#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list