RxJavaFileUtils icon indicating copy to clipboard operation
RxJavaFileUtils copied to clipboard

Inconsistencies in events between operating systems

Open rvanheest opened this issue 8 years ago • 1 comments

Hi, we're looking at this library to see whether it will be useful in one of our projects. A first question is whether this library is still maintained and whether people are using it, especially given that it is not that active in commits...

Since this repo does not have much documentation, we're left to figuring out how the API works and what it all does by looking at the code, unit test (single) and just experimenting (which is actually the way I prefer to do things). We're looking at a couple of scenario's right now that sparked some curiosity and raised some questions. These mainly have to do with the events that are being produces by the Observable and their differences between Mac and Windows systems.

(You can find the code for the file system monitor here)

Scenario 1: If a file exists on startup and gets changed after startup On Mac we get a CREATE event for both the folder and the file (both with absolute path), followed by a DELETE of the file with a relative path, even though it still exists On Windows we get only a MODIFY event, however, it contains an invalid path: if we watch the directory <project-base-dir>/target/test/FileUtils/ containing a file hello.txt, the path we get is <project-base-dir>/hello.txt. This happens in all following scenarios on Windows as well!

Scenario 2: Scenario 1 followed by another change On Mac will add a MODIFY event for both the folder and file On Windows will add a MODIFY event for only the file

Scenario 3: Deleting a file On Mac will cause a MODIFY on the folder and a DELETE on the file (the latter with a relative path) On Windows will cause a DELETE on the file alone

Scenario 4: Copy pasting a large file (3,28GB) into the monitored folder On Mac gives a CREATE on both folder and file, immediately followed by a MODIFY on the file On Windows gives a CREATE on the file alone, immediately followed by a MODIFY on the file and another MODIFY on the file as soon as the copy-paste has finished

Scenario 5: (only tested on Windows) writing in a file and saving it On Windows gives inconsistently one or two MODIFY events on the file

Are we missing something here, or are these real bugs. If so, are these already known (can't find any issues on that in this repository) and are they related to either this library or the underlying java.nio.* package?

Curious to see if there are any projects that use this library and how they deal with these scenarios!

rvanheest avatar Nov 15 '16 21:11 rvanheest

Hi @rvanheest,

Indeed, this project is not maintained anymore. The library has been tested on macOS and Linux but never on Windows, it's possible that you find windows related bugs.

One closed-source project was relying on this library to react on modification of a memory mapped file, and as far as I know, everything was working just fine.

The code base is relatively small, and if you want you can make it your own (I can give you access to the repo, if you're interested).

stevegury avatar Nov 15 '16 21:11 stevegury