digitalmars.D.bugs - [Issue 24557] New: File.readln does not properly handle case where
- d-bugmail puremagic.com (35/35) May 20 https://issues.dlang.org/show_bug.cgi?id=24557
https://issues.dlang.org/show_bug.cgi?id=24557 Issue ID: 24557 Summary: File.readln does not properly handle case where last character in terminator is repeated Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: zopsicle use.startmail.com Consider the following program: ----- import std.stdio : readln, writefln; void main() { char[] buf; readln(buf, "ABA"); writefln!"%(%s%)"([buf]); } ----- Compiled and run as follows: ----- $ dmd example.d $ printf 'XABAY' | ./example ----- Expected output: "XABA" Actual output: "XABAY" readln does not properly handle the case where the last character of the terminator (in this case A) appears multiple times in the terminator (in this case, A also appears at the front of the terminator). --
May 20