Closed infeo closed 4 years ago
The following code provides a unit test:
@Test
@DisplayName("simulates Notepad's access pattern during save of a new File")
void testWindowsNotepadSavePatternForNewFiles() {
FuseFileInfo fi1 = TestFileInfo.create();
FileStat stat = TestFileStat.create();
String p = "/foo.txt";
int code = fs.getattr(p,stat);
assert code == -ErrorCodes.ENOENT();
fs.create(p,0644,fi1);
fs.release(p,fi1);
FuseFileInfo fi2 = TestFileInfo.create();
fs.open(p,fi2);
fs.unlink(p);
fs.release(p,fi2);
FuseFileInfo fi3 = TestFileInfo.create();
fs.create(p,0644, fi3);
Assertions.assertEquals(0, fs.getattr(p,stat));
}
Library: WinFSP 1.7 OS: Windows 10 Pro 2004
If a file is opend/created, then deleted and after the release created again, any attempt of reading/writing to the file (i.e. all actions requiring a file channel) will fail and a
ClosedChannelException
is thrown.This can be easily tested by using the
LocalFsProvider
, mirroring a directory and then saving a new file with the Notepad application in the mirror. This app performs the aforementioned sequence of action and therefore fails with an I/O-Error message.