New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream.operation.readUntil: generates broken output when str is changed while reading #960

tomykaira opened this Issue Jan 18, 2015 · 1 comment


None yet
2 participants

tomykaira commented Jan 18, 2015

When used with GzipInputStream and a specific file, content of str set by peek() opeartion.d#L152 is implicitly changed by read() call in skip.
This results in broken output from dst.put.

Simple solution is to replace stream.peek() with stream.peek().dup, which works correctly, but the performance effect may be too much.

Here are test code, but I cannot provide the problematic file, because it contains confidential data.
It is log data with 5 lines and each line contains 100-5000 ascii characters.
I tried to make a similar file, but couldn't.
So sorry about inconvenience.

unittest {
    import vibe.core.file;
    auto fs = openFile("problematic.txt.gz");
    scope(exit) fs.close();

    string byline = "";
    auto gis = new GzipInputStream(fs);
    while (!gis.empty()) {
        byline ~= cast(string) readLine(gis, size_t.max, "\x0a") ~ "\x0a";
    auto gis2 = new GzipInputStream(fs);
    string byall = cast(string) readAll(gis2);
    assert(byline == byall);

This comment has been minimized.

Show comment
Hide comment

s-ludwig Jan 10, 2016


Fixed by 78140aa


s-ludwig commented Jan 10, 2016

Fixed by 78140aa

@s-ludwig s-ludwig closed this Jan 10, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment