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 2013324

Summary: Multiple package-name-spec arguments don't lock correctly
Product: Red Hat Enterprise Linux 8 Reporter: Roberto <moreda>
Component: dnf-plugins-coreAssignee: Nicola Sella <nsella>
Status: CLOSED ERRATA QA Contact: Eva Mrakova <emrakova>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.4CC: james.antill, mbanas, nsella, pkratoch, tbajer
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: dnf-plugins-core-4.0.21-7.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-10 15:23:48 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 Roberto 2021-10-12 15:21:50 UTC
Description of problem:
If multiple package-name-spec arguments are given and the first one is already locked, the rest are not considered.

Version-Release number of selected component (if applicable):
dnf-plugins-core-0:4.0.18-4.el8.noarch
python3-dnf-plugin-versionlock-0:4.0.18-4.el8.noarch

How reproducible:
Trivial to reproduce.

Steps to Reproduce:
1. Lock a package-name-spec:
# dnf versionlock add bind 
2. Lock an additional package-name-spec using multiple arguments:
# dnf versionlock add bind bash

Actual results:
There is a lock for bind but no lock created for bash.

Expected results:
A lock for bind and a lock for bash.

Additional info:
This is a bug related to a rather confusing usage of the variables in the plugin code, where it seems (by naming) that there is no multiple arguments support.

If you follow the flow when adding multiple package-name-specs you will see that when one of them is already locked, the rest will not be added:

1) _search_locklist argument is a list "self.opts.package"  (https://github.com/rpm-software-management/dnf-plugins-core/blob/99a9df5ae4f595131bffb8b8a48973b231522719/plugins/versionlock.py#L174)
2) _match second argument is still a list "package" (https://github.com/rpm-software-management/dnf-plugins-core/blob/99a9df5ae4f595131bffb8b8a48973b231522719/plugins/versionlock.py#L243)
3) finally at _match (https://github.com/rpm-software-management/dnf-plugins-core/blob/99a9df5ae4f595131bffb8b8a48973b231522719/plugins/versionlock.py#L282) the naming comes back to something more appropriate as "patterns", but as soon as one of them actually matches then there is no further match check.

Comment 10 errata-xmlrpc 2022-05-10 15:23:48 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-plugins-core 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-2022:2052