uutils/coreutils · error · std::io::Error
WriteZero
WriteZero
Error message
failed to write whole buffer
What it means
Error "failed to write whole buffer" thrown in uutils/coreutils.
Source
Thrown at src/uu/cp/src/platform/windows.rs:98
Ok(n) => total += n,
Err(e) if e.kind() == std::io::ErrorKind::Interrupted => {}
Err(e) => return Err(e),
}
}
Ok(total)
}
/// Write the whole `buf` to `file` at `offset`, looping over partial writes.
///
/// The Windows-only `seek_write` has no `write_all`-style counterpart (unlike
/// the Unix `write_all_at`), so dropped tails on partial writes are handled
/// here. The `Interrupted` arm mirrors std's own write loops, although Windows
/// file I/O does not produce it.
fn write_all_at(file: &File, mut buf: &[u8], mut offset: u64) -> std::io::Result<()> {
while !buf.is_empty() {
match file.seek_write(buf, offset) {
Ok(0) => {
return Err(std::io::Error::new(
std::io::ErrorKind::WriteZero,
"failed to write whole buffer",
));
}
Ok(n) => {
buf = &buf[n..];
offset += n as u64;
}
Err(e) if e.kind() == std::io::ErrorKind::Interrupted => {}
Err(e) => return Err(e),
}
}
Ok(())
}
/// Error from [`sparse_copy`], separating "the destination filesystem cannot
/// do sparse files" — which callers handle by falling back to a plain copy —
/// from real I/O failures.View on GitHub (pinned to 0b77ced485)
Solutions
- Retry the write in a loop until all bytes are written or a non-interrupted error occurs.
- Verify the destination file handle is valid and the disk is not full before copying.
When it happens
Trigger: Occurs on Windows when cp cannot complete a write to the destination file, e.g. disk full, write to a pipe that closed early, or an I/O error mid-copy.
Common situations: Copying large files to a nearly-full volume, copying to a network share that disconnects, or destination media removed during the copy.
AI-assisted analysis of uutils/coreutils@0b77ced485 (2026-08-19).
Data as JSON: /api/errors/0458afa9f754bf92.
Report an issue: GitHub.