-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Fix io::copy specialization using copy_file_range when writer was opened with O_APPEND #82417
Conversation
r? @kennytm (rust-highfive has picked a reviewer for you, use r? to override) |
680c9fc
to
81602fb
Compare
Thanks! @bors r+ |
📌 Commit 81602fb has been approved by |
Nominating for backport. It's not a critical issue as the copy wil just fail (it doesn't produce incorrect data), but it's a trivial change to backport. (Probably not worth a stable patch release by itself. But if one happens, it'd be good to include this.) |
… r=m-ou-se Fix io::copy specialization using copy_file_range when writer was opened with O_APPEND fixes rust-lang#82410 While `sendfile()` returns `EINVAL` when the output was opened with O_APPEND, `copy_file_range()` does not and returns `EBADF` instead, which – unlike other `EBADF` causes – is not fatal for this operation since a regular `write()` will likely succeed. We now treat `EBADF` as a non-fatal error for `copy_file_range` and fall back to a read-write copy as we already did for several other errors.
☀️ Test successful - checks-actions |
discussed in T-compiler meeting. beta-backport approved. |
stable approved too (not that it matters since release is next week so we're unlikely to have a point release) |
…imulacrum [stable] 1.51.0 release Also includes backports of the release notes, as well as: * SplitInclusive is public API rust-lang#83372 * std: Fix a bug on the wasm32-wasi target opening files rust-lang#82804 * Fix io::copy specialization using copy_file_range when writer was opened with O_APPEND rust-lang#82417 r? `@Mark-Simulacrum`
fixes #82410
While
sendfile()
returnsEINVAL
when the output was opened with O_APPEND,copy_file_range()
does not and returnsEBADF
instead, which – unlike otherEBADF
causes – is not fatal for this operation since a regularwrite()
will likely succeed.We now treat
EBADF
as a non-fatal error forcopy_file_range
and fall back to a read-write copy as we already did for several other errors.