Skip to content

fs::copy() does not handle sparse files #58635

Closed
@haraldh

Description

@haraldh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions