RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1722627 - Path Unit does not catch every event
Summary: Path Unit does not catch every event
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.6
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: systemd-maint
QA Contact: Frantisek Sumsal
Depends On:
TreeView+ depends on / blocked
Reported: 2019-06-20 19:44 UTC by Joerg K
Modified: 2019-10-17 11:47 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2019-10-16 07:33:41 UTC
Target Upstream Version:

Attachments (Terms of Use)
Archive containing Path Unit, Service Unit and example.sh script (381 bytes, application/gzip)
2019-06-20 19:44 UTC, Joerg K
no flags Details

Description Joerg K 2019-06-20 19:44:11 UTC
Created attachment 1582847 [details]
Archive containing Path Unit, Service Unit and example.sh script

Description of problem:
A Path Unit is used to monitor a given path. When the content of the monitored path changes a corresponding Service Unit is triggered which executes a small script which writes the current content of the path into a log file. But not every change to the path gets logged.

For example: Running the command `touch /path/testfile && rm /path/testfile` I would expect to have the content of */path/* logged two times. First when the testfile is created and second when the file is removed. But the log shows an empty path, only.

Version-Release number of selected component (if applicable):
$ sudo yum list systemd
Installed Packages
systemd.x86_64                219-62.el7_6.7                 @rhel-7-server-rpms

How reproducible:
The issue is reproducible with the files from the archive attached to this report.

Steps to Reproduce:
1. mkdir /var/tmp/testdir
2. tar -xvzf test-case.tar.gz
3. sudo cp example.{path,service} /etc/systemd/system/
4. cp example.sh /var/tmp/
5. sudo systemctl daemon-reload
6. sudo systemctl enable example.{path,service}
7. sudo systemctl start example.path
8. touch /var/tmp/testdir/test && rm /var/tmp/testdir/test
9. cat /var/tmp/test-output.txt

Actual results:
$ cat /var/tmp/test-output.txt 
total 0

Expected results:
$ cat /var/tmp/test-output.txt 
total 0
total 0
-rw-rw-r--. 1 user user 0 Jun 20 21:42 test
total 0

Additional info:
Please, feel free to ask if you need additional information.

Comment 2 Joerg K 2019-06-20 21:29:16 UTC
I would like to add that the behaviour described above exists in RHEL 8.0 with systemd-239-13.el8_0.5, too.

How to proceed? Should I clone this bug report to file it against RHEL 8.0 as well?

Comment 3 Jan Synacek 2019-06-21 05:47:17 UTC
(In reply to Joerg K from comment #2)
> How to proceed? Should I clone this bug report to file it against RHEL 8.0 as well?

No need. If we fix this in 7, we will schedule the fix for 8 as well.

Comment 4 Joerg K 2019-06-21 06:43:27 UTC
Hi, Thanks for your reply.

For background information, I have opened the bugzilla here following the [contribution guidelines for downstream versions](https://github.com/systemd/systemd/blob/master/docs/CONTRIBUTING.md) which I found on github.com.

Comment 5 Joerg K 2019-10-15 18:42:07 UTC
Good Evening,

I was wondering if you have decided yet whether or not to fix this in RHEL 7 or RHEL 8?

If it is not asked to much and to prevent unnecessary inquiries, when could a decision be expected?


Comment 6 David Tardon 2019-10-16 07:33:41 UTC
Your test case is inherently racy, in two ways. First, the rm may have finished before the triggered service was even started, so one cannot rely on the "test" file record being present in the log. Second, path units don't queue events that came while the service was running, so one cannot expect to get every event "handled" separately (there was even a recent change to disable watches while the service is running, for performance reasons).

Comment 7 Joerg K 2019-10-17 11:47:59 UTC
Dear David,

Thank you for your response. Allow me one last statement on this report.

You may be right that my test case is racy, but it is a real world example though. What I learned from this bugzilla is that path monitoring with systemd.path(5) without gap is not possible. Thereby the possible field of application is very limited. What a pity!

Thanks again for your time looking into this.

Note You need to log in before you can comment on or make changes to this bug.