Bug 1376179

Summary: DNF query.filter(provides=...) sometimes returns too many results
Product: [Fedora] Fedora Reporter: Stephen Gallagher <sgallagh>
Component: dnfAssignee: rpm-software-management
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 24CC: jmracek, mls, mluscon, packaging-team-maint, pnemade, rpm-software-management, vmukhame
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-14 10:03:57 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:
Attachments:
Description Flags
Reproducer of this issue none

Description Stephen Gallagher 2016-09-14 19:11:28 UTC
Created attachment 1200944 [details]
Reproducer of this issue

Description of problem:
I am trying to build a script to figure out the set of packages required to be self-hosting. While doing so, I noticed a number of packages appearing in the list that didn't make any sense (such as 0ad, a video game that doesn't Provides: anything at all).

I managed to narrow it down to some sort of strange interaction when I take the pkg.requires from a query against one set of repositories (sources) and apply it to the Provides of another set of repos (binaries).


Version-Release number of selected component (if applicable):
python2-dnf-1.1.10-1.fc24.noarch
python2-hawkey-0.6.3-6.fc24.x86_64
libsolv-0.6.23-4.fc24.x86_64

How reproducible:
Every time

Steps to Reproduce:
1. Run attached minimal reproducer
2.
3.

Actual results:
Reproducer returns 2710 packages satisfying the "gcc-c++" dependency.

Expected results:
Reproducer should only return the "gcc-c++" package.

Additional info:

It's possible I've hit an edge-case. If that's so, please recommend a different way that I can determine the BuildRequires of an SRPM and get the list of binary RPMs that satisfies it.

Comment 1 Stephen Gallagher 2016-09-14 20:01:47 UTC
Looks like you just can't mix-and-match results from different repositories.

James Antill pointed out that wrapping the req in str(req) was a decent workaround, which I am going ahead with.

Comment 2 Michael Schröder 2016-09-15 11:05:05 UTC
You can mix-and-match results from different repos, but not from different sacks.

Comment 3 Stephen Gallagher 2016-09-22 18:05:17 UTC
Could we make this a documentation issue, then? Please indicate somewhere in documentation that the objects returned from filtering on one sack are useful only when used within that sack.

Comment 4 Jaroslav Mracek 2017-03-14 10:03:57 UTC
I tested with latest upstream version 
dnf-2.1.0_1-25g6394542.fc25.noarch 
libdnf-0.8.0-0.12gde205c0.fc25.x86_64
libsolv-0.6.26-17g3edcaac.fc25.x86_64
and it works like expected. Your script only returns libstdc++-6.3.1-1.fc25.x86_64.

If you want to test it, please use latest dnf from our test repository (dnf copr enable rpmsoftwaremanagement/dnf-nightly).