Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file_watch-tests fail in v2.9.0 on Arch Linux #6718

Closed
mtorromeo opened this issue May 5, 2023 · 9 comments
Closed

file_watch-tests fail in v2.9.0 on Arch Linux #6718

mtorromeo opened this issue May 5, 2023 · 9 comments
Assignees
Labels
Closed: Fixed Issue was closed as fixed. Future work

Comments

@mtorromeo
Copy link
Contributor

Package is built in a clean chroot.

Output of ./file_watch-tests -d 9:

Running suite(s): file_watch
[sssd] [snotify_watch] (0x2000): Opened inotify fd 5
[sssd] [snotify_watch] (0x2000): Opened file watch -1
[sssd] [snotify_watch] (0x2000): Opened directory watch 1
[sssd] [_snotify_create] (0x0400): Added a watch for /build/sssd/src/sssd-2.9.0/file-watch/watched_file_inotify with inotify flags 0x8D88 internal flags 0x1 using function watched_file_inotify_cb after delay 1.0
[sssd] [modify_file] (0x0400): File modified
[sssd] [process_dir_event] (0x4000): inotify name: watched_file_inotify
[sssd] [process_dir_event] (0x0400): received notification for watched file [watched_file_inotify] under /build/sssd/src/sssd-2.9.0/file-watch
[sssd] [create_dispatcher] (0x0400): Running a timer with delay 1.0
[sssd] [dispatch_event] (0x0400): Dispatched an event with combined flags 0x100
[sssd] [snotify_internal_cb] (0x2000): All inotify events processed
[sssd] [watch_ctx_destructor] (0x2000): Closing inotify fd 5
[sssd] [snotify_watch] (0x2000): Opened inotify fd 5
[sssd] [snotify_watch] (0x2000): Opened file watch 1
[sssd] [snotify_watch] (0x2000): Opened directory watch 2
[sssd] [snotify_rewatch] (0x0400): Recreated watch
[sssd] [watched_file_inotify_cb] (0x1000): Received inotify notification for /build/sssd/src/sssd-2.9.0/file-watch/watched_file_inotify
[sssd] [modify_file] (0x0400): File modified
[sssd] [snotify_watch] (0x2000): Opened inotify fd 5
[sssd] [snotify_watch] (0x2000): Opened file watch 1
[sssd] [snotify_watch] (0x2000): Opened directory watch 2
[sssd] [_snotify_create] (0x0400): Added a watch for /build/sssd/src/sssd-2.9.0/file-watch/watched_file_inotify.exists with inotify flags 0x8D88 internal flags 0x1 using function watched_file_inotify_cb after delay 1.0
[sssd] [callback] (0x0400): Callback invoked
[sssd] [modify_file] (0x0400): File modified
[sssd] [process_file_event] (0x0400): received notification for watched file /build/sssd/src/sssd-2.9.0/file-watch/watched_file_inotify.exists
[sssd] [create_dispatcher] (0x0400): Running a timer with delay 1.0
[sssd] [dispatch_event] (0x0400): Dispatched an event with combined flags 0x8
[sssd] [snotify_internal_cb] (0x2000): All inotify events processed
[sssd] [watched_file_inotify_cb] (0x1000): Received inotify notification for /build/sssd/src/sssd-2.9.0/file-watch/watched_file_inotify.exists
[sssd] [fw_watch_file_poll] (0x3f7c0): File [./file-watch/watched_file_poll] is missing. Will try again later.
[sssd] [set_file_watching] (0x1000): ./file-watch/watched_file_poll missing. Waiting for it to appear.
[sssd] [modify_file] (0x0400): File modified
[sssd] [callback] (0x0400): Callback invoked
[sssd] [modify_file] (0x0400): File modified
[sssd] [poll_watched_file] (0x2000): File [./file-watch/watched_file_poll] changed
[sssd] [callback] (0x0400): Callback invoked
[sssd] [modify_file] (0x0400): File modified
[sssd] [callback] (0x0400): Callback invoked
[sssd] [modify_file] (0x0400): File modified
[sssd] [poll_watched_file] (0x2000): File [./file-watch/watched_file_poll.exists] changed
[sssd] [callback] (0x0400): Callback invoked
50%: Checks: 4, Failures: 2, Errors: 0
src/tests/file_watch-tests.c:134:F:file_watch:test_inotify_no_file:0: Callback not invoked on creation.

src/tests/file_watch-tests.c:189:F:file_watch:test_inotify_with_file:0: Callback not invoked on modification.

config.log

@alexey-tikhonov
Copy link
Member

@aplopez, could you please take a look?

@aplopez
Copy link
Contributor

aplopez commented May 9, 2023

@aplopez, could you please take a look?

I will.

@aplopez
Copy link
Contributor

aplopez commented May 9, 2023

@mtorromeo Could you please add the list of the dependencies (packages) you installed and commands you used to build SSSD (configure, make, etc.)?
I'm having a hard time building SSSD on ArchLinux, which I never did before; and in my Fedora the test passes flawlessly.
Thanks.

@mtorromeo
Copy link
Contributor Author

You can find the PKGBUILD with all the listed dependencies here: https://github.com/archlinux/svntogit-community/blob/packages/sssd/trunk/PKGBUILD

If you want to build this in Arch Linux you can install devtools and run extra-x86_64-build in the directory with the PKGBUILD. This will build it in a clean chroot each time.

Thanks

@mtorromeo
Copy link
Contributor Author

Also, keep in mind that the base and base-devel group of packages are always present even if not listed in the PKGBUILD.

@aplopez
Copy link
Contributor

aplopez commented May 10, 2023

Found the problem.

snotify internally calls realpath() on the filename and works with that new filename. At at higher level, we compare those filenames to check we refer to the same file, but we didn't call realpath().

aplopez added a commit to aplopez/sssd that referenced this issue May 10, 2023
When the watched file was a symbolic link or was a relative path,
the calback was not executed because the filename comparison
was wrongly considering the files to be different.

The solution is to normalize the filenames before comparing them.
This cannot be easily done at setup because the file could not
exist at that moment.

The test was adapted to check this situation.

Resolves: SSSD#6718
@alexey-tikhonov
Copy link
Member

Hi @mtorromeo,

could you please check if patch from #6724 fixes an issue for you?

@mtorromeo
Copy link
Contributor Author

Yes, I can confirm that with the patch all tests are now passing. Thanks

aplopez added a commit to aplopez/sssd that referenced this issue May 11, 2023
When the watched file was a symbolic link or was a relative path,
the calback was not executed because the filename comparison
was wrongly considering the files to be different.

The solution is to normalize the filenames before comparing them.
This cannot be easily done at setup because the file could not
exist at that moment.

The test was adapted to check this situation.

Resolves: SSSD#6718
aplopez added a commit to aplopez/sssd that referenced this issue May 11, 2023
When the watched file was a symbolic link or was a relative path,
the calback was not executed because the filename comparison
was wrongly considering the files to be different.

The solution is to normalize the filenames before comparing them.
This cannot be easily done at setup because the file could not
exist at that moment.

The test was adapted to check this situation.

Resolves: SSSD#6718
pbrezina pushed a commit that referenced this issue May 15, 2023
When the watched file was a symbolic link or was a relative path,
the calback was not executed because the filename comparison
was wrongly considering the files to be different.

The solution is to normalize the filenames before comparing them.
This cannot be easily done at setup because the file could not
exist at that moment.

The test was adapted to check this situation.

Resolves: #6718

Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
(cherry picked from commit b2a4ff2)
@pbrezina
Copy link
Member

Pushed PR: #6724

  • master
    • 90c5490 - TESTS: Fix doble slash comments
    • b2a4ff2 - FILE WATCH: Callback not executed on link or relative path
  • sssd-2-9
    • 0c6f492 - TESTS: Fix doble slash comments
    • eb43c24 - FILE WATCH: Callback not executed on link or relative path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed: Fixed Issue was closed as fixed. Future work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants