node-fs-extra: copy and copySync can fail with 'Source and destination must not be the same'
- Operating System: Windows 10
- Node.js version: 8.11.3
fs-extra
version:7.0.0
copy and copySync will fail with ‘Source and destination must not be the same’ when node occasionally returns the same ino for different files due to a bigint rounding issue (https://github.com/nodejs/node/issues/12115). The solution is probably to set options parameter to { bigint: true } when calling fstat (https://nodejs.org/api/fs.html#fs_fs_fstat_fd_options_callback) from the checkPaths function of copy.js and copy-sync.js.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 10
- Comments: 28 (5 by maintainers)
Commits related to this issue
- CheckPath Error -> Warn of Inode. https://github.com/jprichardson/node-fs-extra/issues/657 — committed to Domvel/node-fs-extra by Domvel 5 years ago
NOTE 🚩 The inode number is an integer unique to the volume upon which it is stored. That means, the method
checkPaths()
disallows me to copy a file from one to another volume. In other words: Remove this. It will randomly fail. Collisions / same values are possible! It’s not only a safe integer issue.@jprichardson @manidlou I recommend to increase the priority of this issue. It’s a critical bug. As I suggested: Enable bigint if supported. And / or remove the checkPaths method (as option or always). If this fixes the bug. (Validate the value of state.ino and what’s about symlinks.) What you think? 🙂
For the time being, would you accept a patch that allows
bigint
to be used in Node versions that have it? So that the end user at least has the ability to fix this issue by upgrading Node? Right now, this defect has enormous impact on downstream functionality and users are left with no option at all.yeah but we should note that
bigint
option was added inv10.5.0
and we are still supporting node>=6
.