Bug 1381506

Summary: dnf fails to find packages matching wildcards
Product: [Fedora] Fedora Reporter: Stephen Tweedie <sct>
Component: dnfAssignee: Jaroslav Mracek <jmracek>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: low    
Version: 26CC: jmracek, jsilhan, mluscon, packaging-team-maint, pnemade, rpm-software-management, vmukhame
Target Milestone: ---Keywords: Reopened, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf-2.6.2-1.fc26 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-07-25 16:56:47 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 Stephen Tweedie 2016-10-04 10:39:25 UTC
Description of problem:
dnf is very picky about how and when it matches a "*" in a wildcard match.  I frequently have to experiment to find a pattern which actually matches installed packages; making a pattern less specific actually *stops* dnf from finding a match.

This is a regression since "yum"; similar patterns work fine with yum on an older RHEL system.

Version-Release number of selected component (if applicable):
dnf-1.1.10-1.fc23.noarch

How reproducible:
100%

Steps to Reproduce:
1. Have more than one kernel rpm installed
2. 
$ sudo dnf remove "kernel*-4.7.3-100.fc23"

works fine, finding multiple installed rpms:
Removing:
 kernel                            x86_64  4.7.3-100.fc23             @updates                0  
 kernel-core                       x86_64  4.7.3-100.fc23             @updates               52 M
 kernel-devel                      x86_64  4.7.3-100.fc23             @updates               40 M
 kernel-modules                    x86_64  4.7.3-100.fc23             @updates               21 M
 kernel-modules-extra              x86_64  4.7.3-100.fc23             @updates              2.0 M
 kmod-nvidia-4.7.3-100.fc23.x86_64 x86_64  1:367.44-1.fc23            @@commandline          17 M
Is this ok [y/N]: N
Operation aborted.

But some *less* specific patterns fail,  Matching the ".fc23" with a wildcard fails:

$ sudo dnf remove "kernel*-4.7.3-100*"
No match for argument: kernel*-4.7.3-100*

And the "-" between N and V in the pattern is mandatory; removing it fails:
$ sudo dnf remove "kernel*4.7.3-100.fc23"
No match for argument: kernel*4.7.3-100.fc23

It appears that dnf is unable to glob-match the "-" or "." separators between N,V and R.  

NB. "yum list available..." has no such problem when run on an older RHEL box, and is able to match patterns like "kernel*2.6.32*" without trouble.

Comment 1 Honza Silhan 2016-10-11 16:57:08 UTC
Thanks for the report. At least "kernel*-4.7.3-100*" should work. The rest of cases would be hard to support. That would need big redesign change.

Comment 2 Stephen Tweedie 2016-10-11 17:29:41 UTC
(In reply to Jan Silhan from comment #1)
> Thanks for the report. At least "kernel*-4.7.3-100*" should work. The rest
> of cases would be hard to support. That would need big redesign change.

Right, I figured globbing over separators might be deep in the design.

It would be useful to target this as part of the yum compatibility work, though; it's exactly the sort of change in semantics that might trip up moving scripts from yum to dnf, as well as being a counter-intuitive UI behaviour.

Comment 3 Fedora End Of Life 2016-11-25 09:36:46 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. 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 Fedora  'version'
of '23'.

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

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 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, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 Stephen Tweedie 2016-11-28 11:04:40 UTC
(In reply to Fedora End Of Life from comment #3)
> Thank you for reporting this issue and we are sorry that we were not 
> able to fix it before Fedora 23 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, you are encouraged  change the 'version' to a later Fedora 
> version prior this bug is closed as described in the policy above.

Reproducible in f25.  But it does seem improved:

(In reply to Honza Silhan from comment #1)
> Thanks for the report. At least "kernel*-4.7.3-100*" should work. The rest
> of cases would be hard to support. That would need big redesign change.

Yes, this format does now work in f25.  Getting rid of an old updates-testing kernel:

$ sudo dnf remove "kernel*4.8.10*"
No match for argument: kernel*4.8.10*
Error: No packages marked for removal.
$ sudo dnf remove "kernel*-4.8.10*"
Dependencies resolved.
...
4.8.10-100.fc23                 @updates-testing                 52 M

Comment 5 Jaroslav Mracek 2016-12-16 15:56:15 UTC
The problem with glob in releasever will be fixed in PR: https://github.com/rpm-software-management/libhif/pull/229

*** This bug has been marked as a duplicate of bug 1267895 ***

Comment 6 Stephen Tweedie 2017-07-19 09:41:20 UTC
Reopening, a different bug was fixed but not the main one here.  "foo-*" is still failing to match any components called "foo-$anything" (re-tested in f26).

The pattern "foo*" works but that is not what I'm after; "foo-*" worked in yum, and this is a regression which is breaking certain searches for me.

One example of a broken search: I would like to match "zlib" and its sub-packages.

"dnf list zlib zlib-*" should work, but does not because "zlib-*" fails to find anything.

"dnf list zlib*" will not work correctly here as that mistakenly pulls in the unrelated component zlibrary and its sub-packages.

Comment 7 Jaroslav Mracek 2017-07-19 15:07:08 UTC
I created a patch that should help (https://github.com/rpm-software-management/libdnf/pull/311).

Comment 8 Stephen Tweedie 2017-07-21 12:19:31 UTC
Just tried the libdnf from the copr 

    https://copr.fedorainfracloud.org/coprs/jmracek/nevra-parser/

and it appears to be working exactly as expected, for the examples I was having trouble with before.  dnf list and update commands both give me the glob matching I expect.

Many thanks!

Comment 9 Fedora Update System 2017-07-24 14:53:06 UTC
libdnf-0.9.3-1.fc26 dnf-plugins-core-2.1.3-1.fc26 dnf-2.6.2-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-6f4c06b2d7

Comment 10 Fedora Update System 2017-07-25 04:27:45 UTC
dnf-2.6.2-1.fc26, dnf-plugins-core-2.1.3-1.fc26, libdnf-0.9.3-1.fc26 has been pushed to the Fedora 26 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-2017-6f4c06b2d7

Comment 11 Stephen Tweedie 2017-07-25 08:52:59 UTC
Looks like the update is working as expected for list, install, update; karma left, thanks!

Comment 12 Fedora Update System 2017-07-25 16:56:47 UTC
dnf-2.6.2-1.fc26, dnf-plugins-core-2.1.3-1.fc26, libdnf-0.9.3-1.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.