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() misses events involving symlinks #27560

Open
Cre3per opened this issue Jan 5, 2025 · 2 comments
Open

Deno.watchFs() misses events involving symlinks #27560

Cre3per opened this issue Jan 5, 2025 · 2 comments

Comments

@Cre3per
Copy link
Contributor

Cre3per commented Jan 5, 2025

Version: Deno 2.1.4

const watcher = Deno.watchFs("/tmp/test/")

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

ln -s /tmp/some-file /tmp/test/

Deno does not report the creation of the symlink because it runs a prefix check along the lines of event.path.startsWith(watchedPath). But event.path is canonicalized to /tmp/some-file, causing the event to be ignored because "it did not occur in the watched path".

This bug causes events in /dev/disk/by-id to be ignored because all files in there are symlinks to other paths in /dev/.

inotifywait reports CREATE, MOVED_FROM, MOVED_TO events in /dev/disk/by-id/ while deno reports remove
Relates to #27559
At least one of these issues is a regression that occurred late in deno 1 or with the switch to deno 2.
Solving #27559 might be enough. My devices trigger too many events to tell quickly if this current issue is actually causing problems.

Related source

|| starts_with_canonicalized(event_path, 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
Copy link
Contributor Author

Cre3per commented Jan 6, 2025

@littledivy #26200 added the is_same_file() || starts_with_canonicalized() check which breaks for symlinks. In the commit message and PR I can't find why we need this check, and all tests pass when I remove it. Do you remember what we need the check for and if it'd be possible to write a test case for it?

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