Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
copy*(): fix copying bind-mounted directories #618
Fixed the issue of infinite loop that would used to happen for cases like bind-mounted directories with subdirectory that would end up creating a lot of recursive same subdirectories and finally failing with
With this fix, we catch these weird cases and throw error with descriptive message.
Also, cleaned up some tests.
These tests that are failing are not related to these changes and are from
Just some thoughts:
Might it be necessary to check up the whole dest path? For example, in the case of:
fs.copy('src', 'dest/sub1/sub2', cb)
If so, perhaps the stats / inode information can be cached, to prevent having to re-fetch this information every time a dir in src is copied. Or, perhaps this check only needs to be made for the main src and dest, and not again inside
* Remove secure-random from dev-deps (#610) * fix ensureDir() doc * moveSync: refactor to use renameSync * copy*(): fix copying bind-mounted directories (#618) * copy*(): fix copying bind-mounted dirs * copy*(): fix case-insensitive-paths tests * copy*(): refactor to check paths more efficiently * destructure stats object after checking err * move*(): check paths before moving * move*(): add case-insensitive paths test * remove unnecessary done callback from test * copy*(): add new option checkPathsBeforeCopying * update copy*() docs to include checkPathsBeforeCopying * some reformatting * copy*(): use fs.stat with bigint option * move*(): refactor to use the internal stat functions * move*(): add test for prevent moving identical * disable graceful-fs in copy and move tests * fix parsing node version * tiny reformat * update copy*() docs * refactor parsing node version * use semver to parse node version in tests