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.

Bug 2129468

Summary: rpm -q doesn't handle arguments with caret (^)
Product: Red Hat Enterprise Linux 9 Reporter: Andrew Schorr <ajschorr>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED ERRATA QA Contact: Eva Mrakova <emrakova>
Severity: medium Docs Contact:
Priority: medium    
Version: CentOS StreamCC: bstinson, ffesti, jwboyer, mbanas, pmatilai
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rpm-4.16.1.3-21.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 08:23:27 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:

Description Andrew Schorr 2022-09-23 21:56:40 UTC
Description of problem:
I could be deluded, but in my experience, rpm -q <package name> should
find the matching package when it is specified in "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}".
But that is not currently working for stb_image-devel and stb_image_write-devel

Version-Release number of selected component (if applicable):
rpm-4.16.1.3-17.el9.x86_64


How reproducible:
always

Steps to Reproduce:
1. rpm -q `rpm -q --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" stb_image-devel`
2.
3.

Actual results:
package stb_image-devel-2.27^20220908git8b5f1f3-0.3.el9.x86_64 is not installed

Expected results:
stb_image-devel-2.27^20220908git8b5f1f3-0.3.el9.x86_64


Additional info:
The same problem exists with stb_image_write-devel:
bash-5.1$ rpm -q `rpm -q --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" stb_image_write-devel`
package stb_image_write-devel-1.16^20220908git8b5f1f3-0.3.el9.x86_64 is not installed

It works fine for most packages, in my experience. This is the first time
I've seen this fail. For example:
bash-5.1$ rpm -q `rpm -q --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" coreutils`
coreutils-8.32-32.el9.x86_64

The goal here is to be able to test whether a certain version of a package is
installed on a system. Is this problem due to the funky VERSION here that contains the caret (^) character?

It works for everything else on the system except the gpg-pubkey rpms:

bash-5.1$ rpm -q `rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n"` | grep 'not installed'
package gpg-pubkey-1d997668-621e3cac.(none) is not installed
package gpg-pubkey-8483c65d-5ccc5b19.(none) is not installed
package gpg-pubkey-3228467c-613798eb.(none) is not installed
package gpg-pubkey-7fac5991-4615767f.(none) is not installed
package gpg-pubkey-296458f3-6230de7d.(none) is not installed
package gpg-pubkey-442df0f8-608c8351.(none) is not installed
package stb_image_write-devel-1.16^20220908git8b5f1f3-0.3.el9.x86_64 is not installed
package stb_image-devel-2.27^20220908git8b5f1f3-0.3.el9.x86_64 is not installed

Using %{nevra} solves the gpg-pubkey issue, but still pukes on these stb_image rpms:

bash-5.1$ rpm -q `rpm -qa --qf "%{nevra}\n"` | grep 'not installed'
package stb_image_write-devel-1.16^20220908git8b5f1f3-0.3.el9.x86_64 is not installed
package stb_image-devel-2.27^20220908git8b5f1f3-0.3.el9.x86_64 is not installed

Comment 1 Andrew Schorr 2022-09-23 22:01:58 UTC
Or for example:

bash-5.1$ diff <(rpm -qa --qf "%{nevra}\n") <(rpm -q --qf "%{nevra}\n" `rpm -qa --qf "%{nevra}\n"`)
2903,2904c2903,2904
< stb_image_write-devel-1.16^20220908git8b5f1f3-0.3.el9.x86_64
< stb_image-devel-2.27^20220908git8b5f1f3-0.3.el9.x86_64
---
> package stb_image_write-devel-1.16^20220908git8b5f1f3-0.3.el9.x86_64 is not installed
> package stb_image-devel-2.27^20220908git8b5f1f3-0.3.el9.x86_64 is not installed


Is this a bug or expected behavior?

Comment 3 Florian Festi 2022-09-30 14:29:17 UTC
There also is an upstream test case: https://github.com/rpm-software-management/rpm/pull/2123/files

Comment 12 errata-xmlrpc 2023-05-09 08:23:27 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 (rpm 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:2538