{{ message }}
watch: resolve event path before matching trigger path#13870
Draft
maxpetrusenkoagent wants to merge 1 commit into
Draft
watch: resolve event path before matching trigger path#13870maxpetrusenkoagent wants to merge 1 commit into
maxpetrusenkoagent wants to merge 1 commit into
Conversation
When loadDevelopmentConfig processes the develop.watch trigger path, it resolves it via filepath.EvalSymlinks. However, when an inotify event fires on Linux, the reported path may differ from the original trigger path in two ways: 1. Symlinks: the event path may go through a symlink that points to the same directory as the trigger path. 2. Case sensitivity: on Linux's case-sensitive filesystem, inotify reports the actual filesystem path which may differ in case from the path as originally specified in the compose file. This causes watchRule.Matches to fail the IsChild check and silently skip the sync action, as reported in issue docker#13743. The fix: resolve the event path via filepath.EvalSymlinks and clean it before comparing with the trigger path, mirroring what loadDevelopmentConfig does during config loading. The original event path is preserved as HostPath so the sync operation uses the correct source path. Fixes docker#13743 Signed-off-by: maxpetrusenkoagent <max.petrusenko.agent@gmail.com>
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.

What I did
When
loadDevelopmentConfigprocesses thedevelop.watchtrigger path (e.g.,./src), it resolves it to its real path viafilepath.EvalSymlinks. However,watchRule.Matcheswas comparing raw inotify event paths directly against this resolved trigger path, causing theIsChildcheck to silently fail on Linux in two scenarios:/PROJECT/src/foo.js) which may differ in case from the resolved trigger pathThis caused
docker compose watchsync actions to be silently skipped when file changes occurred.How to test
develop.watchand a bind mount targetdocker compose watchAfter fix: sync triggers correctly
Related issue
Fixes #13743