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

Deno.watchFs misinterprets grouped events with removed files #27559

Open
Cre3per opened this issue Jan 5, 2025 · 1 comment
Open

Deno.watchFs misinterprets grouped events with removed files #27559

Cre3per opened this issue Jan 5, 2025 · 1 comment

Comments

@Cre3per
Copy link
Contributor

Cre3per commented Jan 5, 2025

Version: Deno 2.1.4

These steps use a /dev path. That's inconvenient for testing, but I can consistently reproduce the event grouping that way.

const watcher = Deno.watchFs("/dev/disk/by-id/")

for await (const event of watcher) {
  console.log(event.kind)
  console.log(event.paths)
}

== Part 1: Watching /dev/disk/by-id yields wrong remove events

  1. watch /dev/disk/by-id
  2. insert a disk (e.g. thumb drive)
  3. among the triggered events are ones containing paths like this (On arch linux)
remove
[
  "/dev/disk/by-id/.#usb-SanDisk_Cruzer_Switch_4C532000030331105325-0:0-part676c089d33331b5da",
  "/dev/disk/by-id/usb-SanDisk_Cruzer_Switch_4C532000030331105325-0:0-part6"
]

The path starting in /dev/disk/by-id/.# does not exist, causing deno to fire a remove event. But the second entry in the paths list does exist.
For reference, inotifywait reports no remove event.

/dev/disk/by-id/ CREATE .#usb-SanDisk_Cruzer_Switch_4C532000030331105325-0:0-part6674a6196a4144492
/dev/disk/by-id/ MOVED_FROM .#usb-SanDisk_Cruzer_Switch_4C532000030331105325-0:0-part6674a6196a4144492
/dev/disk/by-id/ MOVED_TO usb-SanDisk_Cruzer_Switch_4C532000030331105325-0:0-part6

Caused by

} else if event.paths.iter().any(is_file_removed) {

Depending on the meaning of the .# file, I'd expect deno to fire a create or remove event for that file. I expect a create event for the second path, unconditional of the event for the first path.

@Cre3per
Copy link
Contributor Author

Cre3per commented Jan 5, 2025

I'd like to work on this issue if it is low priority because I am low on time

@Cre3per Cre3per changed the title Deno.watchFs loses/misinterprets events involving symlinks Deno.watchFs misinterprets grouped events with removed files Jan 5, 2025
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