Bug 1630113 - Transaction callbacks use action constants that aren't part of the callback API
Summary: Transaction callbacks use action constants that aren't part of the callback API
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 31
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Daniel Mach
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-09-18 02:15 UTC by Adam Williamson
Modified: 2019-09-06 12:30 UTC (History)
5 users (show)

Fixed In Version: dnf-4.2.8-1.fc30
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-09-06 12:30:59 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Bugzilla 1624652 None CLOSED [abrt] dnfdragora-updater: on_RPMProgress(): dnf_backend.py:223:on_RPMProgress:KeyError: 7 2019-09-19 07:01:53 UTC

Internal Links: 1624652

Description Adam Williamson 2018-09-18 02:15:28 UTC
I've been trying to debug a dnfdragora crash:

https://bugzilla.redhat.com/show_bug.cgi?id=1624652

If I got it right, what's basically going on is that a transaction progress callback is using 'action' values that aren't defined in the callback API. The callback API includes these package actions:

PKG_DOWNGRADE = dnf.transaction.PKG_DOWNGRADE  # :api
PKG_INSTALL = dnf.transaction.PKG_INSTALL  # :api
PKG_OBSOLETE = dnf.transaction.PKG_OBSOLETE  # :api
PKG_REINSTALL = dnf.transaction.PKG_REINSTALL  # :api
PKG_REMOVE = dnf.transaction.PKG_ERASE  # :api
PKG_UPGRADE = dnf.transaction.PKG_UPGRADE  # :api

PKG_CLEANUP = dnf.transaction.PKG_CLEANUP  # :api
PKG_VERIFY = dnf.transaction.PKG_VERIFY  # :api
PKG_SCRIPTLET = dnf.transaction.PKG_SCRIPTLET  # :api

the values for those are, respectively:

2
1
4
9
8
6
101
102
103

but in the traceback of the dnfdragora bug, we catch the value '7' showing up for the action:

Local variables in innermost frame:
self: <dnfdragora.dnf_backend.DnfRootBackend object at 0x7fda65f7f320>
package: 'texlive-xetex,7,20180414,19.fc29,x86_64,@System'
action: 7
te_current: 0
te_total: 28
ts_current: 119
ts_total: 232
num: ' ( 119/232 )'
name: 'texlive-xetex-7:20180414-19.fc29.x86_64'

If we look in dnf.transaction, we see some *other* package action constants which aren't in the callback API:

PKG_DOWNGRADE = libdnf.transaction.TransactionItemAction_DOWNGRADE
PKG_DOWNGRADED = libdnf.transaction.TransactionItemAction_DOWNGRADED
PKG_INSTALL = libdnf.transaction.TransactionItemAction_INSTALL
PKG_OBSOLETE = libdnf.transaction.TransactionItemAction_OBSOLETE
PKG_OBSOLETED = libdnf.transaction.TransactionItemAction_OBSOLETED
PKG_REINSTALL = libdnf.transaction.TransactionItemAction_REINSTALL
PKG_REINSTALLED = libdnf.transaction.TransactionItemAction_REINSTALLED
PKG_REMOVE = libdnf.transaction.TransactionItemAction_REMOVE
PKG_UPGRADE = libdnf.transaction.TransactionItemAction_UPGRADE
PKG_UPGRADED = libdnf.transaction.TransactionItemAction_UPGRADED

if we poke those, we find that '7' is actually PKG_UPGRADED:

>>> print(dnf.transaction.PKG_UPGRADED)
7

so it seems that we're getting a progress callback for the action 'upgraded', but that action isn't in the callback API. That seems wrong.

I think the commit that caused this was the one that refactored the progress callbacks to use libdnf as part of the near-removal (only an API-fulfilling stub remains, now) of dnf.transaction, this one:

https://github.com/rpm-software-management/dnf/commit/8198019c0

Comment 1 Adam Williamson 2018-09-18 04:00:16 UTC
For the record, I checked and it doesn't seem like there's any chance this could crash anaconda or lorax in any circumstance. anaconda's and lorax's approach to the callbacks is to handle ones with specific actions and ignore others; dnfdragora/dnfdaemon sort of assumed that they knew *all* possible actions (because they handled all the ones documented in the docs and API...) and the code actually crashes if it runs into an undocumented one.

I don't know what other important components may be tripped up by this, if any.

Comment 3 Ben Cotton 2019-08-13 16:48:51 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to '31'.

Comment 4 Fedora Update System 2019-08-14 12:11:12 UTC
FEDORA-2019-40235845dc has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-40235845dc

Comment 5 Fedora Update System 2019-08-16 19:50:19 UTC
dnf-4.2.8-1.fc30, dnf-plugins-core-4.0.9-1.fc30, dnf-plugins-extras-4.0.5-1.fc30, libdnf-0.35.2-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-40235845dc

Comment 6 Fedora Update System 2019-08-26 13:26:25 UTC
FEDORA-2019-40235845dc has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-40235845dc

Comment 7 Fedora Update System 2019-08-27 18:21:24 UTC
dnf-4.2.8-1.fc30, dnf-plugins-core-4.0.9-1.fc30, dnf-plugins-extras-4.0.5-1.fc30, libdnf-0.35.2-1.fc30, swid-tools-0.8.6-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-40235845dc

Comment 8 Fedora Update System 2019-08-29 05:05:20 UTC
FEDORA-2019-40235845dc has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-40235845dc

Comment 9 Fedora Update System 2019-08-30 00:03:35 UTC
dnf-4.2.8-1.fc30, dnf-plugins-core-4.0.9-1.fc30, libdnf-0.35.2-1.fc30, swid-tools-0.8.6-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-40235845dc

Comment 10 Fedora Update System 2019-09-06 12:30:59 UTC
dnf-4.2.8-1.fc30, dnf-plugins-core-4.0.9-1.fc30, libdnf-0.35.2-1.fc30, swid-tools-0.8.6-1.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, 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.