Bug 1243002

Summary: Query.filter(requires=XXX) fails for lists (or even segfaults)
Product: [Fedora] Fedora Reporter: Michael Mráka <mmraka>
Component: hawkeyAssignee: Valentina Mukhamedzhanova <vmukhame>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: low    
Version: 22CC: jsilhan, mluscon, packaging-team-maint, pnemade, rholy, tim.lauridsen, vmukhame
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: hawkey-0.6.1-2.fc23 hawkey-0.6.1-2.fc22 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-10-04 19:13:15 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 Michael Mráka 2015-07-14 14:28:58 UTC
Description of problem:
>>> len(q.filter(requires='/bin/sh'))
11012
>>> len(q.filter(requires=['/bin/sh']))
0
>>> len(q.filter(requires=['/bin/sh','/bin/sh']))
Segmentation fault (core dumped)


Version-Release number of selected component (if applicable):
dnf-1.0.1-2.fc22.noarch
hawkey-0.5.7-1.fc22.x86_64

How reproducible:
8/10 runs

Steps to Reproduce:
1. cat <<EOF >/tmp/r.py
import dnf
b = dnf.Base()
b.read_all_repos()
b.fill_sack()
q=b.sack.query()
print len(q.filter(requires='/bin/sh'))
print len(q.filter(requires=['/bin/sh']))
print len(q.filter(requires=['/bin/sh','/bin/sh']))
EOF
2. python /tmp/r.py

Actual results:
11012
0
Segmentation fault (core dumped)


Expected results:
111012
111012
111012

Additional info:

Comment 1 Radek Holy 2015-07-15 07:01:05 UTC
Well, it shouldn't work so far. Let's track this as an RFE.

Comment 2 Radek Holy 2015-07-15 07:05:01 UTC
Hm, the "requires" filter is missing at all so far.

Comment 3 Michael Mráka 2015-07-15 07:33:17 UTC
What does exactly mean "is missing at all"?

It's implemented and works (for simple case):
>>> len(q.filter(requires='/bin/sh'))
11012

It's documented: http://dnf.readthedocs.org/en/latest/api_queries.html#dnf.query.Query.filter

Comment 4 Radek Holy 2015-07-15 07:40:21 UTC
No, it isn't documented.

Comment 5 Michael Mráka 2015-07-15 07:44:30 UTC
If something segfaults it's bug not RFE.

And similarly if list in filter works for other options (arch, file, name, release, version, ...) then it's a bug not FRE.

Comment 6 Michael Mráka 2015-07-15 07:46:02 UTC
(In reply to Radek Holy from comment #4)
> No, it isn't documented.

This is not an answer for What does exactly mean "is missing at all"?

Comment 7 Radek Holy 2015-07-15 08:01:07 UTC
OK, I'm not going to repeat in every every discussion with you. That's the last time I repeat it.

The documentation is the only resource you should consult in order to find out if something *should* work. The fact that something works does not mean that it is a feature nor even that it should work.

If you take a look into the documentation, you find out that there is nothing about a support of "requires" nor lists as arguments. This means that you simply cannot say, that it's a bug that a function behaves unexpectedly if you use it in an unexpected way.

(The fact, that ".filter(requires=some_list)" is used in many places simply means that the authors use DNF wrong. Nothing more, nothing less. The only exception is DNF where we can use undocumented features of course.)

Comment 8 Honza Silhan 2015-07-15 09:22:04 UTC
We have it documented in some of the PR which will be merged soon.

Comment 9 Valentina Mukhamedzhanova 2015-09-11 17:12:55 UTC
https://github.com/rpm-software-management/hawkey/pull/108

Comment 10 Fedora Update System 2015-09-22 15:01:42 UTC
hawkey-0.6.1-1.fc23 dnf-plugins-core-0.1.12-2.fc23 dnf-1.1.2-2.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-16428

Comment 11 Fedora Update System 2015-09-22 15:03:31 UTC
dnf-plugins-core-0.1.12-2.fc22 hawkey-0.6.1-1.fc22 dnf-1.1.2-2.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-16429

Comment 12 Fedora Update System 2015-09-23 03:55:00 UTC
dnf-1.1.2-2.fc23, dnf-plugins-core-0.1.12-2.fc23, hawkey-0.6.1-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update dnf-plugins-core dnf hawkey'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-16428

Comment 13 Fedora Update System 2015-09-23 21:22:51 UTC
dnf-1.1.2-2.fc22, dnf-plugins-core-0.1.12-2.fc22, hawkey-0.6.1-1.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update dnf-plugins-core dnf hawkey'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-16429

Comment 14 Fedora Update System 2015-10-02 15:19:31 UTC
dnf-plugins-core-0.1.12-3.fc23 hawkey-0.6.1-2.fc23 dnf-1.1.2-4.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-38e69423f3

Comment 15 Fedora Update System 2015-10-02 15:24:00 UTC
dnf-plugins-core-0.1.12-3.fc22 hawkey-0.6.1-2.fc22 dnf-1.1.2-4.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-3528c659e4

Comment 16 Fedora Update System 2015-10-04 01:35:41 UTC
dnf-1.1.2-4.fc22, dnf-plugins-core-0.1.12-3.fc22, hawkey-0.6.1-2.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update hawkey dnf-plugins-core dnf'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-3528c659e4

Comment 17 Fedora Update System 2015-10-04 01:51:37 UTC
dnf-1.1.2-4.fc23, dnf-plugins-core-0.1.12-3.fc23, hawkey-0.6.1-2.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update hawkey dnf-plugins-core dnf'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-38e69423f3

Comment 18 Fedora Update System 2015-10-04 19:12:27 UTC
dnf-1.1.2-4.fc23, dnf-plugins-core-0.1.12-3.fc23, hawkey-0.6.1-2.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 19 Fedora Update System 2015-10-05 21:51:57 UTC
dnf-1.1.2-4.fc22, dnf-plugins-core-0.1.12-3.fc22, hawkey-0.6.1-2.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.