-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
fs::copy() unix: set file mode early #58803
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
☔ The latest upstream changes (presumably #58208) made this pull request unmergeable. Please resolve the merge conflicts. |
c7a6814
to
d329ec4
Compare
new refined version with better comments and logic |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@bors: r+ |
📌 Commit fb98ca7 has been approved by |
same fix as commit fb98ca7 PR: rust-lang#58803 A convenience method like fs::copy() should try to prevent pitfalls a normal user doesn't think about. In case of an empty umask, setting the file mode early prevents temporarily world readable or even writeable files, because the default mode is 0o666. In case the target is a named pipe or special device node, setting the file mode can lead to unwanted side effects, like setting permissons on /dev/stdout or for root setting permissions on /dev/null.
fs::copy() linux: set file mode early A convenience method like fs::copy() should try to prevent pitfalls a normal user doesn't think about. In case of an empty umask, setting the file mode early prevents temporarily world readable or even writeable files, because the default mode is 0o666. In case the target is a named pipe or special device node, setting the file mode can lead to unwanted side effects, like setting permissons on `/dev/stdout` or for root setting permissions on `/dev/null`. copy_file_range() returns EINVAL, if the destination is a FIFO/pipe or a device like "/dev/null", so fallback to io::copy, too. Fixes: rust-lang#26933 Fixed: rust-lang#37885
fs::copy() linux: set file mode early A convenience method like fs::copy() should try to prevent pitfalls a normal user doesn't think about. In case of an empty umask, setting the file mode early prevents temporarily world readable or even writeable files, because the default mode is 0o666. In case the target is a named pipe or special device node, setting the file mode can lead to unwanted side effects, like setting permissons on `/dev/stdout` or for root setting permissions on `/dev/null`. copy_file_range() returns EINVAL, if the destination is a FIFO/pipe or a device like "/dev/null", so fallback to io::copy, too. Fixes: rust-lang#26933 Fixed: rust-lang#37885
fs::copy() linux: set file mode early A convenience method like fs::copy() should try to prevent pitfalls a normal user doesn't think about. In case of an empty umask, setting the file mode early prevents temporarily world readable or even writeable files, because the default mode is 0o666. In case the target is a named pipe or special device node, setting the file mode can lead to unwanted side effects, like setting permissons on `/dev/stdout` or for root setting permissions on `/dev/null`. copy_file_range() returns EINVAL, if the destination is a FIFO/pipe or a device like "/dev/null", so fallback to io::copy, too. Fixes: rust-lang#26933 Fixed: rust-lang#37885
fs::copy() linux: set file mode early A convenience method like fs::copy() should try to prevent pitfalls a normal user doesn't think about. In case of an empty umask, setting the file mode early prevents temporarily world readable or even writeable files, because the default mode is 0o666. In case the target is a named pipe or special device node, setting the file mode can lead to unwanted side effects, like setting permissons on `/dev/stdout` or for root setting permissions on `/dev/null`. copy_file_range() returns EINVAL, if the destination is a FIFO/pipe or a device like "/dev/null", so fallback to io::copy, too. Fixes: rust-lang#26933 Fixed: rust-lang#37885
Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Hmpf, this filesystem test fails on |
A convenience method like fs::copy() should try to prevent pitfalls a normal user doesn't think about. In case of an empty umask, setting the file mode early prevents temporarily world readable or even writeable files, because the default mode is 0o666. In case the target is a named pipe or special device node, setting the file mode can lead to unwanted side effects, like setting permissons on `/dev/stdout` or for root setting permissions on `/dev/null`. copy_file_range() returns EINVAL, if the destination is a FIFO/pipe or a device like "/dev/null", so fallback to io::copy, too. Use `fcopyfile` on MacOS instead of `copyfile`. Fixes: rust-lang#26933 Fixed: rust-lang#37885
added
to test |
removed the ignore and added
|
Another alternative would be to use TempDir as |
Or just |
Hm I wonder if this test could just be ignored on emscripten? You can just add a |
Basically I did that with the latest version. For emscripten it's the old unchanged test (which should pass then) and for all the others it is hopefully picking up the current executable as the test file. |
Oh sure yeah and this might pass, but it's pretty jarring to be reading a test and randomly see a conditional statement for one particular platform. It's pretty common, however, to ignore tests on platforms for various reasons, so I think it's best to just ignore the whole test |
I didn't want to take away the test for emscripten, because it seems to pass in the past. |
Let's please ignore the test for emscripten, because we don't really need to keep tests running that just happened to pass before. |
here we go, although that contradicts my understanding of a CI |
@bors: r+ |
📌 Commit cf8347b has been approved by |
fs::copy() unix: set file mode early A convenience method like fs::copy() should try to prevent pitfalls a normal user doesn't think about. In case of an empty umask, setting the file mode early prevents temporarily world readable or even writeable files, because the default mode is 0o666. In case the target is a named pipe or special device node, setting the file mode can lead to unwanted side effects, like setting permissons on `/dev/stdout` or for root setting permissions on `/dev/null`. copy_file_range() returns EINVAL, if the destination is a FIFO/pipe or a device like "/dev/null", so fallback to io::copy, too. Fixes: rust-lang#26933 Fixed: rust-lang#37885
Rollup of 12 pull requests Successful merges: - #57987 (Fix some AArch64 typos) - #58581 (Refactor generic parameter encoder functions) - #58803 (fs::copy() unix: set file mode early) - #58848 (Prevent cache issues on version updates) - #59198 (Do not complain about unmentioned fields in recovered patterns) - #59351 (Include llvm-ar with llvm-tools component) - #59413 (HirIdify hir::ItemId) - #59441 (Remove the block on natvis for lld-link.) - #59448 (Use consistent phrasing for all macro summaries) - #59456 (Add documentation about `for` used as higher ranked trait bounds) - #59472 (Document that `std::io::BufReader` discards contents on drop) - #59474 (Fix link capitalization in documentation of std::io::BufWriter.) Failed merges: r? @ghost
Halleluja 😀 |
A convenience method like fs::copy() should try to prevent pitfalls a
normal user doesn't think about.
In case of an empty umask, setting the file mode early prevents
temporarily world readable or even writeable files,
because the default mode is 0o666.
In case the target is a named pipe or special device node, setting the
file mode can lead to unwanted side effects, like setting permissons on
/dev/stdout
or for root setting permissions on/dev/null
.copy_file_range() returns EINVAL, if the destination is a FIFO/pipe or
a device like "/dev/null", so fallback to io::copy, too.
Fixes: #26933
Fixed: #37885