Closed
Description
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
.