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

macOS and linux: no way to correlate rename events #278

Closed
christian-schulze opened this issue Jun 20, 2021 · 5 comments
Closed

macOS and linux: no way to correlate rename events #278

christian-schulze opened this issue Jun 20, 2021 · 5 comments

Comments

@christian-schulze
Copy link

File move operations on MacOS are reported by fswatch as pairs of Renamed events. The first event being the source and the second event being the destination.

Given the following scenario, the events are not reported in the correct order:

touch a 1; mv a b; mv 1 2; mv b c; mv 2 3

Actual output:

  1. a -> CREATED RENAMED IS_FILE
  2. 1 -> CREATED RENAMED IS_FILE
  3. b -> RENAMED IS_FILE
  4. c -> RENAMED IS_FILE
  5. 2 -> RENAMED IS_FILE
  6. 3 -> RENAMED IS_FILE

Given these results, there is no way to correlate event 3 with 1, and event 5 with 2.

If the Created and Renamed events were not merged into one event, then this might behave as expected. Is this something that fswatch is doing explicitly? Or is this what the MacOS API is reporting?

@emcrisostomo
Copy link
Owner

This is exactly what the macOS API is reporting, I'm afraid. There should be a way to correlate multiple rename events using inode identifiers (available since macOS 10.13 High Sierra IIRC), but I haven't looked into it yet.

@christian-schulze
Copy link
Author

@emcrisostomo yes agreed, I've actually patched the fsevents node module to support this:
fsevents/fsevents#360

@emcrisostomo
Copy link
Owner

Thanks for the feedback @christian-schulze

@emcrisostomo emcrisostomo changed the title MacOS - no way to correlate rename events macOS and linux: no way to correlate rename events Jul 10, 2022
@emcrisostomo
Copy link
Owner

I've update the issue since I've fixed this in the feature branch for both the fsevents_monitor and the inotify_monitor.

@emcrisostomo
Copy link
Owner

Merged into master.

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

2 participants