← Back to index
|
Original Bugzilla link
Bug 21480 – uncaught exceptions: stack trace truncated at NUL char
Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2020-12-14T00:00:39Z
Last change time
2022-04-04T21:43:17Z
Assigned to
No Owner
Creator
kdevel
Comments
Comment #0
by kdevel — 2020-12-14T00:00:39Z
from
http://forum.dlang.org/thread/
[email protected]
#post-ggyxirvvnypggstfkbzj:40forum.dlang.org
~~~char2.d void main () { import std.stdio; import std.conv; char [2] win = [0, 'X']; auto ne = new Exception ("A " ~ win.to!string ~ " B"); try throw ne; catch (Exception e) writeln ("exception caught: e.msg = <", e.msg, ">"); throw ne; } ~~~ Output: exception caught: e.msg = <A X B>
[email protected]
(6): A <--- truncated at \0 [...] Commment from P.B.: This is definitely a bug. The problem is that the D runtime uses `fprintf` to print the exception's error message, when it should be using `fwrite`:
https://github.com/dlang/druntime/blob/v2.094.2/src/rt/dmain2.d#L733
Comment #1
by kdevel — 2022-04-04T21:43:17Z
*** This issue has been marked as a duplicate of issue 20778 ***