-
Notifications
You must be signed in to change notification settings - Fork 3
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
EncryptedFS.rmdir
does not remove files on Windows
#69
Comments
EncryptedFS.rmdir
does not remove file descriptors on Windows
What is an |
Rmdir is not supposed to remove files. See: https://nodejs.org/api/fs.html#fspromisesrmdirpath-options. |
The |
What tests are failing here due to this? |
So far it's all of the concurrency tests that have failures, but I haven't gone over all of the failures yet. I can put together a list. |
Yea please create list. And also identify the offending usage of On Linux and MacOS, it should be throwing |
Looking at https://nodejs.org/api/fs.html#fspromisesrmdirpath-options I think that this should be throwing an Not to be confused with |
It's not being directly supplied a file descriptor, rather |
Directories and subdirectories cannot "contain" file descriptors. |
Can you point out a part of the EFS where it is doing this? I don't see any file descriptors within directories. There are no such thing. FDs are just numbers. |
The example script in the issue description here is essentially what's happening in all of the affected tests. The FD points to a file inside the directory that |
The above 2 points are true independently of each other. |
Deleting directories and files is about deleting their hardlinks. There is no interaction with the FD system. |
EncryptedFS.rmdir
does not remove file descriptors on WindowsEncryptedFS.rmdir
does not remove files on Windows
Tests that are affected by this issue:
These are the ones that I'm fairly certain are affected by this. There are other test failures but whether or not they are related to this I'm not sure. |
First note, If we want recursive behaviour then we should be using Some details from the nodejs documentation.
Testing with So my suggest fix for this is removing the |
The fact that it has different behaviour is weird. I'm going to look into this more. As for the test failures. Looks like a lot of the stem from this problem. We're using There also seems to be a problem with permissions that needs exploring. |
Yes, see MatrixAI/Polykey#60. It's already an issue for this. However |
Yes this is why it doesn't make sense to me about any kind of file descriptor situation. @emmacasolin posted a reproduction up top, that you can try to see between Try using SSH it's alot faster. Instructions are in matrix-team. |
I found the problem in the example. It's the usage of In the example we use the following to create the directory state. const path1 = path.join('dir', 'file1');
await efs.mkdir('dir');
await efs.mkdir('dir/dir2');
let fd = await efs.open(path1, 'wx+');
await efs.close(fd); In linux this is fine, however in windows the
So the example under windows we're only removing the So the next question is. how does and should the encrypted fs handle this difference between platforms? I'll have to review how the paths work currently to know what's it's doing currently. |
Ah this is a simple problem to solve. Back in VFS, we always used our own custom path join. We never just use There should be a |
Make sure all tests and all src files are using
And any |
Yep, I'll make the changes now. |
Is there a PR that exists for this issue? MatrixAI/Polykey#67? or make a new one? |
Yea use MatrixAI/Polykey#67. |
Using `path.join` caused the tests to use the windows' separator for the path which is not supported by the EFS. This lead to a lot of test failures. #69
Using `path.join` caused the tests to use the windows' separator for the path which is not supported by the EFS. This lead to a lot of test failures. #69
Using `path.join` caused the tests to use the windows' separator for the path which is not supported by the EFS. This lead to a lot of test failures. #69
The fix has been pushed to MatrixAI/Polykey#67. There are some failing tests there but I tested the fix on |
Using `path.join` caused the tests to use the windows' separator for the path which is not supported by the EFS. This lead to a lot of test failures. #69
Fix has been moved to MatrixAI/Polykey#68 now. |
Describe the bug
EncryptedFS.rmdir()
does not work as expected on Windows. It removes directories but not files.Update: The issue may in fact be that Linux and Mac are removing files when they shouldn't and Windows is actually behaving correctly. This would mean that the tests are wrong. The tests that fail on Windows due to this all throw an EEXIST error when trying to open a (new) file and create a file descriptor to it. When this happens the error looks something like this:
To Reproduce
Run the following script on Windows:
Output:
Expected behavior
The file should not exist after
rmdir
is called. This is observed when running the same script on Linux:Platform
Additional context
May be related to MatrixAI/Polykey-CLI#14
The text was updated successfully, but these errors were encountered: