Skip to content

fix(watch): skip unreadable directories instead of failing the watch - #13992

Open
Endika wants to merge 2 commits into
docker:mainfrom
Endika:fix/watch-unreadable-directory
Open

fix(watch): skip unreadable directories instead of failing the watch#13992
Endika wants to merge 2 commits into
docker:mainfrom
Endika:fix/watch-unreadable-directory

Conversation

@Endika

@Endika Endika commented Jul 31, 2026

Copy link
Copy Markdown

What I did

compose watch registers an inotify watch on every directory below the watched
path. A single directory the current user cannot read makes registration fail
with permission denied, and the whole watch fails to start — so nothing gets
watched at all.

Permission errors are now treated the way the surrounding code already treats
os.IsNotExist: log at debug level and filepath.SkipDir. Losing visibility
into one subtree should not cost the entire watch.

Includes a regression test in watcher_naive_test.go, which fails without the
change.

Related issue

closes #13750

domesticated-upset-golden-retriever-looking-out-window-missing-his-owner by https://www.magnific.com/

@Endika
Endika requested review from a team as code owners July 31, 2026 17:45
@Endika
Endika requested review from glours and ndeloof July 31, 2026 17:45
Signed-off-by: Endika Iglesias <endika2@gmail.com>
@Endika
Endika force-pushed the fix/watch-unreadable-directory branch from eacf003 to e72f36a Compare August 1, 2026 07:47
@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/watch/watcher_naive.go 0.00% 8 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

CI runs the tests as root, where the unreadable-directory test is always
skipped. Extract the WalkDir callbacks and inject the watch registration
so a synthetic permission error can drive those branches instead.

Signed-off-by: Endika Iglesias <endika2@gmail.com>
@Endika
Endika force-pushed the fix/watch-unreadable-directory branch from a82f4ea to 7900d4b Compare August 1, 2026 13:12
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

Successfully merging this pull request may close these issues.

[BUG] watch tries to read ignored folders leading to permission denied

1 participant