-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
writeFileAll lacks sufficient unit test coverage #7014
Copy link
Copy link
Open
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Milestone
Description
writeFileAll (and writeFileAllUnseekable together with writeFileAllSendfile) are underspecified and can easily turn into infinite loops:
*Unseekableenters an infinite loop wheneverin_offsetis past the input EOF,- Same for
*Sendfile, you get stuck in a loop wheresendfilekeeps reading zero bytes, - (In
*Sendfile) Ifcountis zero you can't really tell if the offset is valid or not as you don't know where the EOF is, /// If the size of the source file is known, passing the size here will save one syscall.the extrastatcall is never done in any case, not knowing the file size leads to the previous problem,- There's no mention that the
iovecs can be mutated in case of short writes (mutating the input parameters makes the API even more awful than it already is, the caller cannot reuse the iovec array across calls), - The test coverage is absymal, there's no explicit test with pipes and/or other unseekable files
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.