fs: give directories created by cpSync the source directory's mode · nodejs/node@40bdf32 · GitHub
Skip to content

Commit 40bdf32

Browse files
codebytereaduh95
authored andcommitted
fs: give directories created by cpSync the source directory's mode
The C++ fast path that fs.cpSync() takes when no filter is given created the destination directories with default permissions, so a 0700 directory came out of the copy as 0755 (with the default umask). The JavaScript implementation, which fs.cp(), fs.promises.cp() and fs.cpSync() with a filter still use, chmod()s every directory it creates to the mode of its source, and so did cpSync before the port. Set the source directory's permissions on each directory the copy creates (the destination root included); directories that already exist keep theirs, as before. Signed-off-by: Shelley Vohr <shelley.vohr@gmail.com> PR-URL: #65488 Refs: #58461 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
1 parent 55213fd commit 40bdf32

2 files changed

Lines changed: 90 additions & 2 deletions

File tree

‎src/node_file.cc‎

Lines changed: 26 additions & 2 deletions
Lines changed: 64 additions & 0 deletions

0 commit comments

Comments
 (0)