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

Test (and fix) behavior of MemoryFile on Windows when the file is moved while open #158

Open
jamesderlin opened this issue Jul 1, 2020 · 0 comments

Comments

@jamesderlin
Copy link
Collaborator

In #157, I made MemoryFile/MemoryRandomAccessFile try to handle the file being renamed/moved/removed from under them. Currently they always follow POSIX behavior (the equivalent of the open file handle tracks the equivalent of the inode), which is consistent with how dart:io File behaves on POSIX systems.

I have not verified what happens on Windows systems, but I expect that rename/move/remove operations on dart:io's File will fail with an exception if they're attempted on files with open handles. If so, MemoryFile should follow the behavior and
would need to keep track of openRead/openWrite/open/openAsync calls (and determine when the corresponding Stream/IOSink/MemoryRandomAccessFile is closed) and disallow the file from being renamed/moved/removed. (For completeness I think we'd also need to prevent such operations on all parent directories too.)

Since one might want to test behavior for a platform other what a test is running on, @dnfield suggested that we could make the behavior configurable based on the FileSystemStyle.

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

No branches or pull requests

1 participant