Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1963704 - `dnf provides` requires a wildcard or else it only matches full paths
Summary: `dnf provides` requires a wildcard or else it only matches full paths
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 34
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Jaroslav Mracek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-05-23 15:05 UTC by Nate Graham
Modified: 2021-06-15 14:45 UTC (History)
10 users (show)

Fixed In Version: dnf-4.8.0-1.fc35
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-06-15 07:21:42 UTC
Type: Bug


Attachments (Terms of Use)

Description Nate Graham 2021-05-23 15:05:54 UTC
`dnf provides` expects to be given a full path, which is not a great default as someone using it is unlikely to know the full path and will only know the name of the missing file. To find it, the user must also know that they must add a wildcard or else the file will not be found.

For example:


dnf provides Qt5PositioningConfig.cmake
Last metadata expiration check: 17:51:58 ago on Sat 22 May 2021 03:11:02 PM MDT.
Error: No Matches found



dnf provides *Qt5PositioningConfig.cmake
Last metadata expiration check: 17:51:58 ago on Sat 22 May 2021 03:11:02 PM MDT.
mingw32-qt5-qtlocation-5.15.2-2.fc34.noarch : Qt5 for Windows - QtLocation component
Repo        : fedora
Matched from:
Other       : *Qt5PositioningConfig.cmake

mingw64-qt5-qtlocation-5.15.2-2.fc34.noarch : Qt5 for Windows - QtLocation component
Repo        : fedora
Matched from:
Other       : *Qt5PositioningConfig.cmake

qt5-qtlocation-devel-5.15.2-5.fc34.i686 : Development files for qt5-qtlocation
Repo        : fedora
Matched from:
Other       : *Qt5PositioningConfig.cmake

qt5-qtlocation-devel-5.15.2-5.fc34.x86_64 : Development files for qt5-qtlocation
Repo        : @System
Matched from:
Other       : *Qt5PositioningConfig.cmake

qt5-qtlocation-devel-5.15.2-5.fc34.x86_64 : Development files for qt5-qtlocation
Repo        : fedora
Matched from:
Other       : *Qt5PositioningConfig.cmake




Consider dropping the requirement for the wildcard and matching against full paths by default.

Comment 1 Jaroslav Mracek 2021-05-25 12:48:15 UTC
I suggest that there is a misunderstanding in usage. In case that you want to search for a file you search pattern must start with `/` or `*/` (*/Qt5PositioningConfig.cmake or /*Qt5PositioningConfig.cmake). The prefix is required for two reason: performance optimization and unexpected results. A lot of strings combined with `*` can match a lot of unwanted results.

Are you satisfied with the answer?

Comment 2 Nate Graham 2021-05-25 17:49:39 UTC
Well, not really, sorry. :)  This isn't the way searching works in other contexts (even for other CLI tools), so it wasn't an expected behavior to me, nor one that I was able to guess. Neal Gompa had to explain it to me when I asked why the tool seems to be broken.

At the very minimum I would expect this usage quirk to be mentioned in `dnf provides --help`.

Comment 3 Jaroslav Mracek 2021-05-31 09:15:10 UTC
Good point, we have to improve documentation.

Comment 4 Jaroslav Mracek 2021-06-01 05:25:29 UTC
I tried to improve documentation by adding information how file provides are identified. See: https://github.com/rpm-software-management/dnf/pull/1773. Please feel free to comment the pull request.

Comment 5 Nate Graham 2021-06-01 13:43:52 UTC
Thanks, I will take a look.

Comment 6 Nate Graham 2021-06-01 17:02:01 UTC
Hmm, I'm not sure that the very technical text proposed in that MR would have helped me very much. :)

Comment 7 Fedora Update System 2021-06-15 07:21:42 UTC
FEDORA-2021-78c5f8c03d has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 8 Nate Graham 2021-06-15 14:45:47 UTC
The upstream merge request is not yet merged, and even if it was, the wording change proposed wouldn't really help me much. Re-opening.


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