digitalmars.D.bugs - [Issue 14315] New: [snn] scanf can't read lines longer than 32767
- via Digitalmars-d-bugs (39/39) Mar 21 2015 https://issues.dlang.org/show_bug.cgi?id=14315
https://issues.dlang.org/show_bug.cgi?id=14315 Issue ID: 14315 Summary: [snn] scanf can't read lines longer than 32767 characters Product: D Version: D1 & D2 Hardware: x86_64 OS: Windows Status: NEW Severity: major Priority: P1 Component: druntime Assignee: nobody puremagic.com Reporter: ag0aep6g gmail.com Found by Dennis Ritchie, and reduced by Ivan Kazmenko, in d.learn: http://forum.dlang.org/thread/cilhjlyoeqgxffbosqju forum.dlang.org Tested through wine with DMD32 D Compiler v2.066.1. No problem on linux. Couldn't test -m64 with wine. Works fine with lengths up to 32767. a.d (generates a long line): ---- import std.range, std.stdio; void main () {'a'.repeat (100_000).writeln;} ---- b.d (tries to read it): ---- import core.stdc.stdio: printf, scanf; import core.stdc.string: strlen; void main () { char [100_000 + 1] a; scanf ("%s", a.ptr); printf("%d\n", a.ptr.strlen); /* prints "32767", should print "100000" */ } ---- Compile and run: ---- dmd a.d && dmd b.d && (./a | ./b) ---- --
Mar 21 2015