Skip to content

fix(folderwatcher): ignore events for stale inotify watch descriptors#10389

Open
thstyl2000 wants to merge 2 commits into
nextcloud:masterfrom
thstyl2000:agent/improve-stale-watch-test-20260716-f2f9
Open

fix(folderwatcher): ignore events for stale inotify watch descriptors#10389
thstyl2000 wants to merge 2 commits into
nextcloud:masterfrom
thstyl2000:agent/improve-stale-watch-test-20260716-f2f9

Conversation

@thstyl2000

@thstyl2000 thstyl2000 commented Jul 16, 2026

Copy link
Copy Markdown

Summary

The desktop client (linux) may escape the watched folders and starts iterating on the root partition. This happens almost certainly, when for example working with codex-cli: codex writes and deletes files relatively fast, so an added watcher resolves into "/" and nextcloud starts iterating from there.

A bit more precise:

  • A missing descriptor previously inserted an empty QString into _watchToPath.
  • Combining that empty value for example with "lib" produced /lib, which could then be traversed and recursively watched.

What this PR implements:

  • Unknown descriptors are now ignored before constructing a path.
  • A test. It feeds slotReceivedNotification() a synthetic IN_CREATE event with an unknown descriptor and verifies that the descriptor is not inserted into _watchToPath.

TODO

  • Run CI test suite.

Checklist

AI (if applicable)

@thstyl2000
thstyl2000 marked this pull request as ready for review July 16, 2026 15:48

@nilsding nilsding left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, thanks! one note though about the test:

Comment thread test/testinotifywatcher.cpp Outdated
@thstyl2000
thstyl2000 force-pushed the agent/improve-stale-watch-test-20260716-f2f9 branch from c07d340 to 8fb2086 Compare July 16, 2026 17:47

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8fb20863fc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/gui/folderwatcher_linux.cpp
@thstyl2000

Copy link
Copy Markdown
Author

good catch, thanks! one note though about the test:

You are welcome! It was not sth i could really avoid "not catching", the laptop was brought seriously on its knees....

Thanks for replying so quickly!

@claucambra claucambra left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of nitpicks!

Comment thread src/gui/folderwatcher_linux.cpp
Comment thread test/testinotifywatcher.cpp Outdated
@thstyl2000
thstyl2000 requested a review from nilsding July 17, 2026 10:27
@thstyl2000
thstyl2000 force-pushed the agent/improve-stale-watch-test-20260716-f2f9 branch from dce19a5 to 104f352 Compare July 17, 2026 13:30
@thstyl2000

Copy link
Copy Markdown
Author

@nilsding @claucambra Squashed the commits to get the one test passing, now it needs another approval, sorry!

@github-actions

Copy link
Copy Markdown
Contributor

Artifact containing the AppImage: nextcloud-appimage-pr-10389.zip

Digest: sha256:889def72af66236967686f6eb96b20f873d25242cd2e109da355163c3ab8925f

To test this change/fix you can download the above artifact file, unzip it, and run it.

Please make sure to quit your existing Nextcloud app and backup your data.

@thstyl2000

thstyl2000 commented Jul 17, 2026

Copy link
Copy Markdown
Author

@nilsding @claucambra sorry once more, I thought updating branch was harmless, and now you need to approve again.....

...not touching anything here myself again unless you tell me to!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9305639411

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/gui/folderwatcher_linux.h
Assisted-by: Codex:GPT-5
Co-authored-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: thstyl2000 <18458458+thstyl2000@users.noreply.github.com>
@thstyl2000
thstyl2000 force-pushed the agent/improve-stale-watch-test-20260716-f2f9 branch from 81e185f to e6dfc8b Compare July 18, 2026 08:11
@thstyl2000

Copy link
Copy Markdown
Author

@nilsding @claucambra sorry once more, I thought updating branch was harmless, and now you need to approve again.....

...not touching anything here myself again unless you tell me to!

...lied (addressed codex review)

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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.

3 participants