You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
fs.copyFile with COPYFILE_FICLONE flag does not overwrite destination if it exists #27273
According to https://github.com/nodejs/node/blob/master/doc/api/fs.md#fscopyfilesrc-dest-flags-callback the default behaviour of fs.copyFile is to overwrite the destination if it already exists. The documentation further gives the example of using fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE to create a copy-on-write reflink which fails if the destination exists.
constfs=require('fs');// first copy succeedsfs.copyFile('source.txt','destination.txt',fs.constants.COPYFILE_FICLONE,(err)=>{if(err)throwerr;console.log('source.txt was copied to destination.txt');});// destination now exists, causing copy operation to failfs.copyFile('source.txt','destination.txt',fs.constants.COPYFILE_FICLONE,(err)=>{if(err)throwerr;console.log('source.txt was copied to destination.txt');});
The latest version of libuv (#27241) is switching from the macOS native copyfile(3) implementation to the more Unix-like generic implementation (libuv/libuv#2233). Would it be possible to test if the behavior still exists with the changed implementation?
Activity
richardlau commentedon Apr 17, 2019
The latest version of libuv (#27241) is switching from the macOS native copyfile(3) implementation to the more Unix-like generic implementation (libuv/libuv#2233). Would it be possible to test if the behavior still exists with the changed implementation?
cc @nodejs/libuv
rudolf commentedon Apr 17, 2019
I can confirm that #27241 solves the issue.
deps: upgrade to libuv 1.28.0
deps: upgrade to libuv 1.28.0