-
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
fs::copy() does not handle sparse files #58635
Comments
see #58636 for the fix |
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`. Not handling sparse files could fill up the users disk very quickly. Fixes: rust-lang#26933 rust-lang#37885 rust-lang#58635
I believe we've decided that sparse files are not something we want to handle; the file mode and special device issue we've fixed. Closing. |
@Mark-Simulacrum I realize this is an old issue but can you share some insights into why it was decided that sparse files are not something you want to handle? There are a few growing rust projects related to VMMs like ( https://github.com/firecracker-microvm/firecracker ) that are built largely with rust and frequently trip over this limitation. |
@Mark-Simulacrum thanks, will follow up as you suggest after reading those items. |
A convenience method like fs::copy() should try to prevent pitfalls a
normal user doesn't think about.
Not handling sparse files could fill up the users disk very quickly.
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
.See also
#26933
#37885
The text was updated successfully, but these errors were encountered: