Skip to content
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() linux: handle sparse files and set file mode early #58636

Closed
wants to merge 1 commit into from

Commits on Feb 22, 2019

  1. fs::copy() linux: handle sparse files and 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`.
    
    Not handling sparse files could fill up the users disk very quickly.
    
    Fixes:
    rust-lang#26933
    rust-lang#37885
    rust-lang#58635
    haraldh committed Feb 22, 2019
    Configuration menu
    Copy the full SHA
    81118c3 View commit details
    Browse the repository at this point in the history