Fix io::copy specialization using copy_file_range when writer was opened with O_APPEND#82417
Merged
bors merged 2 commits intorust-lang:masterfrom Mar 12, 2021
Merged
Conversation
Contributor
|
r? @kennytm (rust-highfive has picked a reviewer for you, use r? to override) |
680c9fc to
81602fb
Compare
Member
|
Thanks! @bors r+ |
Collaborator
|
📌 Commit 81602fb has been approved by |
Member
|
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.) |
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this pull request
Mar 11, 2021
… 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.
Collaborator
Collaborator
|
☀️ Test successful - checks-actions |
Contributor
|
discussed in T-compiler meeting. beta-backport approved. |
Contributor
|
stable approved too (not that it matters since release is next week so we're unlikely to have a point release) |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 22, 2021
…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`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #82410
While
sendfile()returnsEINVALwhen the output was opened with O_APPEND,copy_file_range()does not and returnsEBADFinstead, which – unlike otherEBADFcauses – is not fatal for this operation since a regularwrite()will likely succeed.We now treat
EBADFas a non-fatal error forcopy_file_rangeand fall back to a read-write copy as we already did for several other errors.