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

Conversation

Domvel
Copy link

@Domvel Domvel commented Mar 27, 2019

Fixes #657

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.

No option provided, because checking if Inode is the wrong way. It's not only a big-integer issue. Inodes are only unique to the volume upon which it is stored.

This will fix the issue #657
I keep it as warning to see it when is happen.
Maybe not the best solution. But with the thrown error, it is not possible to use it.
Example: It's not possible to stable build with Android-Cordova 8.x. Because Cordova switched to fs-extra since version 8.x.

Better solutions are welcome. But keep in mind that the Inode (state.ino of fs) is not really unique global and in current fs-extra implementation. Again:

  • The inode number is an integer unique to the volume upon which it is stored.
  • state.ino of fs also supports big-integer. Node version 10.4 is required to use this. But currently it's set for number (53-bit) only.

The aim is to remove / replace this check. Because it's faulty. (Inode) You'll get errors from fs / os.

@iamsim
Copy link

iamsim commented Mar 27, 2019

@Domvel, Ive been following you in all the comments from various bugs referring the same issue.
I just want to ask one thing, have you found any work around for this?
I also cannot build the app since 2 days and am in trouble. Please help me!

@Domvel
Copy link
Author

Domvel commented Mar 27, 2019

@iamsim Oh, I have a stalker. 😄 There is no software-workaround. Because the method checkPaths is fixed invoked by fs-extra. And Cordova just use it. We built up a linux server for jenkins to build it.

Until this bug will not be fixed, there are two known "workarounds" It's more a dilemma:

  • Build on Linux and keep Cordova 8.x.
  • Downgrade to Cordova 7.x and also build on Windows. Because Cordova 7.x does not use fs-extra.

If the maintainers of fs-extra will fix the bug by allow big-integers, the bug of copy between different volumes are still present. If they still comparing the Inode (state.ino of fs).
Or Cordova should replace fs-extra again.

As I suggested: Just remove the state.ino check and let the OS or the underlayed libs throw errors, if source === destination.
But for you, you should build on linux or downgrade.
Another dirty solution - but not tested: Modify the fs-extra dist JavaScript files and remove the check of Inode in checkPaths method. Hack the file every time you downloaded it from npm. I do not recommend this, but it should also work. 🙂

I can't understand the relaxed behavior for this critical bug. I can not say when and if the problem will ever be fixed.

@iamsim
Copy link

iamsim commented Mar 28, 2019

Downgrade to Cordova 7.x and also build on Windows. Because Cordova 7.x does not use fs-extra.

Doing this now!
Will keep you updated if I find a fix.
But please keep me in mind if you find a fix.

Really thank you for a response. 🙂

@@ -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.

@manidlou
Copy link
Collaborator

Closing this as the issue is fixed in fs-extra v8.

@manidlou manidlou closed this May 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

copy and copySync can fail with 'Source and destination must not be the same'
5 participants