Skip to content

Commit

Permalink
CheckPath Error -> Warn of Inode.
Browse files Browse the repository at this point in the history
  • Loading branch information
Domvel committed Mar 27, 2019
1 parent 8e08791 commit a1240b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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(
'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

2 comments on commit a1240b1

@Domvel
Copy link
Owner Author

@Domvel Domvel commented on a1240b1 Mar 27, 2019

Choose a reason for hiding this comment

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

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.
Also fs-extra does not set the big-integer flag of node fs. It's only a "default" JavaScript number (max integer is 53-bit). See the difference here On Windows the cap is reached.

See jprichardson#657.

@klvs
Copy link

@klvs klvs commented on a1240b1 May 1, 2019

Choose a reason for hiding this comment

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

Hey, is this an issue unique to windows? I've been getting the same error on Mac OS but I suspect it's unrelated.

Please sign in to comment.