Skip to content

file_watch.c: Do not pass IN_IGNORED to inotify_add_watch#8228

Merged
alexey-tikhonov merged 1 commit into
SSSD:masterfrom
arrowd:inotify-in-ignore
Nov 25, 2025
Merged

file_watch.c: Do not pass IN_IGNORED to inotify_add_watch#8228
alexey-tikhonov merged 1 commit into
SSSD:masterfrom
arrowd:inotify-in-ignore

Conversation

@arrowd

@arrowd arrowd commented Nov 24, 2025

Copy link
Copy Markdown
Contributor

This is an output flag and it doesn't make sense to pass it as input. FreeBSD implementation is more finicky, so passing this flag makes the call fail.

Fixes the file-watch-tests test on FreeBSD.

@gemini-code-assist gemini-code-assist 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.

Code Review

The pull request addresses an issue where IN_IGNORED was incorrectly passed as an input flag to inotify_add_watch. As correctly identified in the pull request description, IN_IGNORED is an output-only event flag in the inotify API, used to signal that a watch has been removed. Passing it as an input flag is incorrect and, as noted, causes failures on systems like FreeBSD. The change to remove this flag is correct and improves the portability and correctness of the file watching mechanism. The fix is well-targeted and I see no further issues.

@arrowd

arrowd commented Nov 24, 2025

Copy link
Copy Markdown
Contributor Author

Hmm, maybe we should add | IN_IGNORE to snctx->cb.mask in

if ((snctx->cb.mask & ev_flags) == 0) {
to ensure that the change does not alter any behavior.

@alexey-tikhonov alexey-tikhonov added the no-backport This should go to target branch only. label Nov 24, 2025
@aplopez

aplopez commented Nov 24, 2025

Copy link
Copy Markdown
Contributor

Hmm, maybe we should add | IN_IGNORE to snctx->cb.mask in

if ((snctx->cb.mask & ev_flags) == 0) {

to ensure that the change does not alter any behavior.

I agree. This would be the only missing detail.

@aplopez aplopez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.
Thank you.

@alexey-tikhonov

Copy link
Copy Markdown
Member

/gemini review

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request correctly addresses an issue where IN_IGNORED was incorrectly passed as an input flag to inotify_add_watch, which caused failures on FreeBSD. The change in src/util/file_watch.c removes this flag from the input mask, aligning with its nature as an output flag. Complementary to this, the modification in src/util/inotify.c ensures that IN_IGNORED events are properly dispatched, even if not explicitly requested in the watch mask, by including it in the event filtering logic. Both changes are crucial for the correctness and robustness of the inotify-based file watching mechanism, especially on platforms like FreeBSD.

@alexey-tikhonov alexey-tikhonov added the coverity Trigger a coverity scan label Nov 24, 2025
@alexey-tikhonov

Copy link
Copy Markdown
Member

Note: Covscan is green.

@alexey-tikhonov alexey-tikhonov added Accepted and removed coverity Trigger a coverity scan labels Nov 25, 2025
This is an output flag and it doesn't make sense to pass it as input.
FreeBSD implementation is more finicky, so passing this flag makes the call
fail.

Fixes the file-watch-tests test on FreeBSD.

Reviewed-by: Alexey Tikhonov <[email protected]>
Reviewed-by: Alejandro López <[email protected]>
@sssd-bot

Copy link
Copy Markdown
Contributor

The pull request was accepted by @alexey-tikhonov with the following PR CI status:


🟢 CodeFactor (success)
🟢 CodeQL (success)
🟢 osh-diff-scan:fedora-rawhide-x86_64:upstream (success)
🟢 rpm-build:centos-stream-10-x86_64:upstream (success)
🟢 rpm-build:fedora-41-x86_64:upstream (success)
🟢 rpm-build:fedora-42-x86_64:upstream (success)
🟢 rpm-build:fedora-43-x86_64:upstream (success)
🟢 rpm-build:fedora-rawhide-x86_64:upstream (success)
🟢 Analyze (target) / cppcheck (success)
🟢 Build / freebsd (success)
🟢 Build / make-distcheck (success)
🟢 ci / intgcheck (centos-10) (success)
🟢 ci / intgcheck (fedora-41) (success)
🟢 ci / intgcheck (fedora-42) (success)
🟢 ci / intgcheck (fedora-43) (success)
🟢 ci / intgcheck (fedora-44) (success)
🟢 ci / prepare (success)
🔴 ci / system (centos-10) (failure)
🟢 ci / system (fedora-41) (success)
🟢 ci / system (fedora-42) (success)
🔴 ci / system (fedora-43) (failure)
🟡 ci / system (fedora-44) (in_progress)
➖ Coverity scan / coverity (skipped)
🟢 Static code analysis / codeql (success)
🟢 Static code analysis / pre-commit (success)
🟢 Static code analysis / python-system-tests (success)


There are unsuccessful or unfinished checks. Make sure that the failures are not related to this pull request before merging.

@alexey-tikhonov
alexey-tikhonov merged commit a881e10 into SSSD:master Nov 25, 2025
3 of 8 checks passed
@arrowd
arrowd deleted the inotify-in-ignore branch November 25, 2025 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Accepted no-backport This should go to target branch only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants