Thread overview
[Issue 14315] [snn] scanf can't read lines longer than 32767 characters
Mar 21, 2015
Ivan Kazmenko
Mar 21, 2015
FG
Mar 21, 2015
Ivan Kazmenko
Mar 21, 2015
FG
Dec 17, 2022
Iain Buclaw
March 21, 2015
https://issues.dlang.org/show_bug.cgi?id=14315

Ivan Kazmenko <gassa@mail.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gassa@mail.ru
           Hardware|x86_64                      |x86

--- Comment #1 from Ivan Kazmenko <gassa@mail.ru> ---
Thank you for reporting it - and fixing the array size.

My system where it is reproducible is 64-bit Windows.

For me, "dmd -m32" gives the error, "dmd -m64" does not.  So I changed the "hardware" selector from x86_64 to x86.

--
March 21, 2015
https://issues.dlang.org/show_bug.cgi?id=14315

FG <home@fgda.pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |home@fgda.pl

--- Comment #2 from FG <home@fgda.pl> ---
I can confirm the problem. Interestingly, it occurs when trying to scanf a long string without whitespace immediately followed by \r\n. There was no problem when the line ended with just a \n, didn't end at all, or when the string was followed by whitespace and some other chars.

--
March 21, 2015
https://issues.dlang.org/show_bug.cgi?id=14315

--- Comment #3 from Ivan Kazmenko <gassa@mail.ru> ---
(In reply to FG from comment #2)
> I can confirm the problem. Interestingly, it occurs when trying to scanf a long string without whitespace immediately followed by \r\n. There was no problem when the line ended with just a \n, didn't end at all, or when the string was followed by whitespace and some other chars.

Hmm, this is not the case here.  What system do you use for testing?

Either converting line endings dos2unix, removing end-of-line sequence completely, or using any of the two following generators, I still get 32767:

gen2.d (generate two long words on a line)
-----
import std.range, std.stdio;
void main () {'a'.repeat (50000).repeat (2).join (' ').writeln;}
-----

gen3.d (generate one long and one short word on a line)
-----
import std.range, std.stdio;
void main () {['a'.repeat (100000).array, "b"].join (' ').writeln;}
-----

--
March 21, 2015
https://issues.dlang.org/show_bug.cgi?id=14315

--- Comment #4 from FG <home@fgda.pl> ---
Sorry, forget my comment. I was testing on the wrong files. Now that I corrected them I see that it always prints 32767, regardless of the situation I previously described.

--
April 28, 2015
https://issues.dlang.org/show_bug.cgi?id=14315

dennis.m.ritchie@mail.ru changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dennis.m.ritchie@mail.ru

--
June 09, 2015
https://issues.dlang.org/show_bug.cgi?id=14315

Andrei Alexandrescu <andrei@erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|D1 & D2                     |D2

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=14315

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2

--
December 07
https://issues.dlang.org/show_bug.cgi?id=14315

--- Comment #5 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/17295

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--