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 2006018 - dnf upgrade fails when upgrading arch-specific package to noarch if a file/URL is specified
Summary: dnf upgrade fails when upgrading arch-specific package to noarch if a file/UR...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: dnf
Version: 8.4
Hardware: Unspecified
OS: Unspecified
low
unspecified
Target Milestone: rc
: ---
Assignee: Nicola Sella
QA Contact: Jan Blazek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-09-20 17:21 UTC by Todd Allen
Modified: 2023-05-16 11:09 UTC (History)
13 users (show)

Fixed In Version: dnf-4.7.0-13.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-16 09:06:59 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Makefile & spec files to make and install/uprade example rpm's. (730 bytes, application/gzip)
2021-09-20 17:21 UTC, Todd Allen
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-122446 0 None None None 2022-05-18 13:07:59 UTC
Red Hat Product Errata RHBA-2023:2980 0 None None None 2023-05-16 09:07:24 UTC

Description Todd Allen 2021-09-20 17:21:21 UTC
Created attachment 1824728 [details]
Makefile & spec files to make and install/uprade example rpm's.

Description of problem:
When the currently-installed package has a specific architecure (it-1.0-1.x86_64), and a command like the following is specified:
   dnf upgrade it-2.0-1.noarch.rpm
Then the upgrade fails.  If the same package were specified by package name and downloaded from a repo, it would work.

Version-Release number of selected component (if applicable):
Observed in 4.0.9 (CentOS 8.2), 4.4.2 (f29), 4.8.0 (f34).

How reproducible:
Always.

Steps to Reproduce:
1. rpm -ivh it-1.0-1.x86_64.rpm
2. dnf upgrade it-2.0-1.noarch.rpm

Actual results:
Package it not installed, cannot update it.
No match for argument: it-2.0-1.noarch.rpm
Error: No packages marked for upgrade.

Expected results:
The upgrade should happen.

Additional info:
See the attachment for an example of this.  Just run "make".  It will construct
two "it" packages, install the first one, and then attempt to upgrade to the
second.

I discovered this while working on a GUI that makes use of the dnf.Base API.
It was using the dnf.Base.package_upgrade function for all upgrades.  But the
dnf command-line interface uses the dnf.Base.upgrade function for
upgrades-by-package-name, and only uses the dnf.Base.package_upgrade function
for upgrades-by-filename.

dnf.Base.package_upgrade is where the problem exists.  And this is why it only
appears in the relatively rare upgrade-by-filename.  Anyway, it makes a call to:
   q = self.sack.query().installed().filterm(name=pkg.name, arch=[pkg.arch, "noarch"])
The pkg in this case is the "new" package (e.g. it-2.0-1.noarch), so the arch
parameter ends up being ['noarch', 'noarch'].  But neither of those is 'x86_64'.
(It's interesting that there's an explicit mention of 'noarch' here.  Clearly
the writer of this code was thinking of noarch->x86_64 upgrades, but not the
other way around.)
I suspect that, for an upgrade to 'noarch', this needs to do a more "vague"
lookup to find all packages with the given name.

Comment 1 Nicola Sella 2021-09-27 11:40:50 UTC
Hello, I see that you run `dnf upgrade it-2.0-1.noarch.rpm`. Is this a typo? This is not correct for dnf upgrade.

Dnf supports installing/updating from a local rpm, but does not work if the file is not in the path: you should provide just the package name, like `dnf upgrade it-2.0-1.noarch`.

Please, could you try with `dnf upgrade it-2.0-1.noarch`? Thank you

Comment 2 Todd Allen 2021-09-27 13:44:04 UTC
That is not a typo, and the command is accepted.  It just fails for the reasons outlined.
In that example, it-2.0-1.noarch.rpm is a local rpm, as you can deduce from the ".rpm" on the end.
Trying with the command you suggested would be doomed to failure because the rpm is not in a repo.
I bothered to create a self-contained example attached.  Just try it.

Comment 3 Nicola Sella 2021-09-27 14:38:31 UTC
Apologies, you are right. I will investigate and work on it. Thank you for the detailed information

Comment 4 Ben Cotton 2022-05-12 16:54:30 UTC
This message is a reminder that Fedora Linux 34 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 34 on 2022-06-07.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '34'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 34 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 5 Todd Allen 2022-05-18 12:46:33 UTC
Confirmed that it still is happening with 8.4, which is not nearing end-of-life.

Comment 7 Jaroslav Mracek 2022-07-25 09:06:39 UTC
I guess that the problem is related to the query on line 2131 of base.py `q = installed.filter(name=pkg.name, arch=[pkg.arch, "noarch"])`

May be we can make `arch` optional filter if `pkg.name == "noarch"`. What do you think?

Comment 17 errata-xmlrpc 2023-05-16 09:06:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (dnf bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2980


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