Bug 2023311

Summary: rpm seems to be calling wrong transfiletriggers
Product: [Fedora] Fedora Reporter: Zbigniew JÄ™drzejewski-Szmek <zbyszek>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 35CC: igor.raits, mjw, packaging-team-maint, pmatilai, pmoravco, vmukhame
Target Milestone: ---Keywords: Reopened, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rpm-4.17.0-3.fc35 rpm-4.17.0-4.fc35 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2023692 2023693 (view as bug list) Environment:
Last Closed: 2022-02-04 01:23:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2023692, 2023693    

Description Zbigniew Jędrzejewski-Szmek 2021-11-15 12:22:12 UTC
Description of problem:

I have various transfiletrigger in systemd, but the one that is relevant is this:

$ rpm -q --filetriggers systemd|grep -B2 'user-reload '
transfiletriggerpostun scriptlet (using /bin/sh) -- /etc/systemd/user, /usr/lib/systemd/user
# Execute daemon-reload in user managers.
/usr/lib/systemd/systemd-update-helper user-reload || :
--
transfiletriggerpostun scriptlet (using /bin/sh) -- /etc/systemd/user, /usr/lib/systemd/user
# We restart remaining user services that should be restarted here.
/usr/lib/systemd/systemd-update-helper user-restart || :

As you can see, they should trigger on /etc/systemd/user and /usr/lib/systemd/user.

When I install systemd-resolved, they trigger unexpectedly:

$ sudo dnf reinstall -y --rpmverbosity=debug https://kojipkgs.fedoraproject.org//packages/systemd/249.7/1.fc35/x86_64/systemd-resolved-249.7-1.fc35.x86_64.rpm
...
D: %transfiletriggerpostun(systemd-249.7-1.fc35.x86_64): scriptlet start
D: %transfiletriggerpostun(systemd-249.7-1.fc35.x86_64): execv(/bin/sh) pid 4516
D: Plugin: calling hook scriptlet_fork_post in selinux plugin
D: setexecfilecon: (/bin/sh, rpm_script_t) 
+ /usr/lib/systemd/systemd-update-helper user-reload
Failed to start transient service unit: Connection reset by peer
Failed to reload daemon: Transport endpoint is not connected
D: %transfiletriggerpostun(systemd-249.7-1.fc35.x86_64): waitpid(4516) rc 4516 status 0
...
D: %transfiletriggerpostun(systemd-249.7-1.fc35.x86_64): scriptlet start
D: %transfiletriggerpostun(systemd-249.7-1.fc35.x86_64): execv(/bin/sh) pid 4529
D: Plugin: calling hook scriptlet_fork_post in selinux plugin
D: setexecfilecon: (/bin/sh, rpm_script_t) 
+ /usr/lib/systemd/systemd-update-helper user-restart
Failed to start transient service unit: Connection reset by peer
Failed to start jobs: Transport endpoint is not connected
D: %transfiletriggerpostun(systemd-249.7-1.fc35.x86_64): waitpid(4529) rc 4529 status 0

The scriptlets fail because of some bug, I'm now investigating that. But the fact the the trigger fires at all seems to be a bug too. The package that is being installed has no files that would match those patterns:

$ rpm -ql systemd-resolved|grep user|wc -l
0

Version-Release number of selected component (if applicable):
systemd-249.7-1.fc35.x86_64
systemd-resolved-249.7-1.fc35.x86_64
rpm-4.17.0-1.fc35.x86_64
dnf-4.9.0-1.fc35.noarch

How reproducible:
Deterministic

Steps to Reproduce:
See above.

Actual results:
%transfiletriggerpostun fires, even though no files under the specified paths have been touched.

Expected results:
The trigger does not fire.

Comment 1 Panu Matilainen 2021-11-15 13:23:16 UTC
Easily reproduced, seems like a bug indeed. Thanks for reporting.

Comment 2 Fedora Update System 2022-01-14 13:21:09 UTC
FEDORA-2022-50caea0dda has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2022-50caea0dda

Comment 3 Fedora Update System 2022-01-15 02:16:02 UTC
FEDORA-2022-50caea0dda has been pushed to the Fedora 35 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-50caea0dda`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-50caea0dda

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 4 Fedora Update System 2022-01-21 16:21:36 UTC
FEDORA-2022-50caea0dda has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 5 Panu Matilainen 2022-02-02 09:11:42 UTC
Reopening, the "fix" only doesn't actually fix the issue but also causes a terrible performance regression in some cases. Blush, pretty embarrassing.

Comment 6 Fedora Update System 2022-02-02 12:50:49 UTC
FEDORA-2022-a9a84f2456 has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2022-a9a84f2456

Comment 7 Fedora Update System 2022-02-03 01:35:25 UTC
FEDORA-2022-a9a84f2456 has been pushed to the Fedora 35 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-a9a84f2456`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-a9a84f2456

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2022-02-04 01:23:02 UTC
FEDORA-2022-a9a84f2456 has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.