Conversation
PollWatcher::watch returned Ok(()) for a path that could not be stat-ed: the fs::metadata failure inside WatchData::new was folded into an Option that watch_inner ignored, so the watch was silently skipped. Propagate the error through build_watch_data and watch_inner instead, mapping it with Error::io_watch so a missing path surfaces as ErrorKind::PathNotFound, matching the other backends. Fixes notify-rs#998
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PollWatcher's
watch()returnedOk(())for paths that cannot be stat-ed because thefs::metadatafailure insideWatchData::newwas folded into anOptionthatwatch_innersilently ignored, violating the documentedWatcher::watch/watch_withcontract that nonexistent paths yield an error.This change threads the error through
build_watch_dataandwatch_inner, mapping it with the existingError::io_watchhelper soio::ErrorKind::NotFoundsurfaces asErrorKind::PathNotFound(with the requested path attached) and other io failures asErrorKind::Io, matching how the inotify and FSEvents backends already behave. Runtime polling semantics are unchanged: an existing watch whose root later disappears is kept and reports scan errors as events.Adds poll-backend unit tests covering the nonexistent-path error and successful watches of an existing file and directory, plus a changelog entry.
Fixes #998