Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CheckPath Error -> Warn of Inode. #666

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/copy-sync/copy-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ function checkStats (src, dest) {
function checkPaths (src, dest) {
const {srcStat, destStat} = checkStats(src, dest)
if (destStat.ino && destStat.ino === srcStat.ino) {
throw new Error('Source and destination must not be the same.')
console.warn(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering your comment on the fact that inodes can be the same when copying across volumes, then this is a totally valid use case, I would remove this warning and the if statement alltogether.

Copy link
Author

@Domvel Domvel May 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a hotfix to disable the Inode check completely and just log a warning. Not only when copying across volumes. Also big integer issue. It just disables the checkPath in a way that it does not throw an error in this case.

Anyway, this pull-requests can be closed. If I understand it correctly, the issue will be fixed in #667 too.

'Source and destination must not be the same.',
'Dest Inode: ' + destStat.ino,
'Src Inode: ' + srcStat.ino
)
}
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
throw new Error(`Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`)
Expand Down
6 changes: 5 additions & 1 deletion lib/copy/copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,11 @@ function checkPaths (src, dest, cb) {
if (err) return cb(err)
const {srcStat, destStat} = stats
if (destStat.ino && destStat.ino === srcStat.ino) {
return cb(new Error('Source and destination must not be the same.'))
console.warn(
'Source and destination must not be the same.',
'Dest Inode: ' + destStat.ino,
'Src Inode: ' + srcStat.ino
)
}
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
return cb(new Error(`Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`))
Expand Down