Bug 2217057 - %postun script's logic seems flawed
Summary: %postun script's logic seems flawed
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: zfs-fuse
Version: 37
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Gwyn Ciesla
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-06-23 17:04 UTC by Tim Landscheidt
Modified: 2023-07-05 01:19 UTC (History)
1 user (show)

Fixed In Version: zfs-fuse-0.7.2.2-28.fc38 zfs-fuse-0.7.2.2-28.fc37
Clone Of:
Environment:
Last Closed: 2023-06-28 01:15:47 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Tim Landscheidt 2023-06-23 17:04:23 UTC
On update, zfs-fuse-0.7.2.2-27.fc37.x86_64 emitted:

| […]
|   Ausgeführtes Scriptlet: zfs-fuse-0.7.2.2-23.fc37.x86_64                                                                                                                              5/5 
| Removing files since we removed the last package
| […]

This felt odd as the package zfs-fuse definitely remained on the system.

The relevant %postun section reads:

| %postun
| %systemd_postun_with_restart zfs-fuse.service 
| echo "Removing files since we removed the last package"
| rm -rf /var/run/zfs
| rm -rf /var/lock/zfs

This seems to be the result of a logic error introduced by commit 1c50d5e79b9266a45f91d70eacec10fb745529f1; prior to that, %postun read:

| if [ $1 -ge 1 ] ; then
|     echo "Restarting since we have updated the package"
|     /sbin/service %{name} condrestart >/dev/null 2>&1 || :
| else
|     echo "Removing files since we removed the last package"
|     rm -rf /var/run/zfs
|     rm -rf /var/lock/zfs
| fi

This was changed to:

| /bin/systemctl daemon-reload >/dev/null 2>&1 || :
| if [ $1 -ge 1 ] ; then
|     # Package upgrade, not uninstall
|     /bin/systemctl try-restart zfs-fuse.service >/dev/null 2>&1 || :
|     echo "Removing files since we removed the last package"
|     rm -rf /var/run/zfs
|     rm -rf /var/lock/zfs
| fi

I. e., the "else" line was omitted.  AFAICT, this is not the intended behaviour.

Reproducible: Didn't try

Comment 1 Gwyn Ciesla 2023-06-26 16:48:19 UTC
Ah, yes, and then it changed to %systemd_postun_with_restart, which includes the -ge logic but no else. I'll add an -lt stanza to address this. Good catch, thank you!

Comment 2 Fedora Update System 2023-06-26 17:34:29 UTC
FEDORA-2023-e1cf11093f has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2023-e1cf11093f

Comment 3 Fedora Update System 2023-06-27 10:45:19 UTC
FEDORA-2023-e1cf11093f has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-e1cf11093f`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-e1cf11093f

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

Comment 4 Fedora Update System 2023-06-27 10:55:37 UTC
FEDORA-2023-00ef1c59f6 has been pushed to the Fedora 38 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-00ef1c59f6`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-00ef1c59f6

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

Comment 5 Fedora Update System 2023-06-28 01:15:47 UTC
FEDORA-2023-00ef1c59f6 has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 6 Fedora Update System 2023-07-05 01:19:11 UTC
FEDORA-2023-e1cf11093f has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.


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