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
std.io.Reader.readUntilDelimiter*
functions lose last byte if it is past the max size
#9594
Labels
bug
Observed behavior contradicts documented or intended behavior
contributor friendly
This issue is limited in scope and/or knowledge of Zig internals.
standard library
This issue involves writing Zig code for the standard library.
Milestone
Comments
Vexu
added
bug
Observed behavior contradicts documented or intended behavior
contributor friendly
This issue is limited in scope and/or knowledge of Zig internals.
standard library
This issue involves writing Zig code for the standard library.
labels
Aug 20, 2021
Could you elaborate on "this could be resolved by requiring space for the delimiter"? I'm not sure I understand the proposal. const std = @import("std");
test "9594" {
const reader = std.io.fixedBufferStream("1234567\n").reader();
var buf: [3 + 1]u8 = undefined; // I want to read at most 3 byte, + 1 for the delimiter
try std.testing.expectError(error.StreamTooLong, reader.readUntilDelimiter(&buf, '\n')); // ← still eats the '5'?
try std.testing.expectEqualStrings("567", try reader.readUntilDelimiter(&buf, '\n')); // ← reads "67\n" instead
} |
scorphus
added a commit
to scorphus/zig
that referenced
this issue
Jan 9, 2022
scorphus
added a commit
to scorphus/zig
that referenced
this issue
Jan 9, 2022
scorphus
added a commit
to scorphus/zig
that referenced
this issue
Jan 10, 2022
scorphus
added a commit
to scorphus/zig
that referenced
this issue
Jan 15, 2022
scorphus
added a commit
to scorphus/zig
that referenced
this issue
Jan 15, 2022
Vexu
pushed a commit
that referenced
this issue
Jan 24, 2022
andrewrk
pushed a commit
that referenced
this issue
Feb 3, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Observed behavior contradicts documented or intended behavior
contributor friendly
This issue is limited in scope and/or knowledge of Zig internals.
standard library
This issue involves writing Zig code for the standard library.
Seems like this could be resolved by requiring space for the delimiter.
More tests are also needed.
The text was updated successfully, but these errors were encountered: