Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
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.
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.
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?
(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.
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?
Regards,
Joerg
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).
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.
Joerg
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.