Bug 1497188 - hy_subject_get_best_solution() does not consider architecture whitelist set by dnf_sack_set_arch()
Summary: hy_subject_get_best_solution() does not consider architecture whitelist set b...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: libdnf
Version: 29
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: rpm-software-management
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-29 12:24 UTC by Alex Kanavin
Modified: 2018-09-30 17:05 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-09-30 17:05:48 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Alex Kanavin 2017-09-29 12:24:48 UTC
When creating queries from package specs, hy_subject_get_best_solution() does not filter the results according to what package architectures are allowed (which was previously set via dnf_sack_set_arch()).

Normally this is not an issue, as packages with an incorrect architecture will later be rejected anyway through checks happening in libsolv, but in Yocto project we found a scenario where it does lead to an incorrect decision.

Specifically:

1. The system architecture is set to "correct-arch".

2. The installation repository contains two packages:
- package "abc.incorrect-arch"
- package "xyz.correct-arch", with "provides: abc"

3. What then happens is that hy_subject_get_best_solution() will pick "abc" package for the installation (because the code that would consider packages with "provides: abc" is not even reached). Then later the "abc" package will be rejected by libsolv, even though the correct solution would've been to pick "xyz".

More info here:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=12025

I have considered various ways to fix this, but I can't decide which would be the optimal one. This is something for libdnf maintainer to ponder, I guess:

1) Add HY_ONLY_INSTALLABLE to _hy_query_flags, use it in hy-query.c init_result() to filter the package set with the help of pool_installable() from libsolv.

2) Add hy_query_filter_installable() funtcion to hy-query.c, which would use the same pool_installable() to filter the package set. Call it from  hy_subject_get_best_solution().

3) Add HY_PKG_INSTALLABLE type of filter, otherwise similar to solution 2.

4) in hy_subject_get_best_solution() get the list of allowed architectures (libsolv or libdnf do not provide a convenience function for it, but it can be done). 
Then issue:
    hy_query_filter_in(query, HY_PKG_ARCH, HY_EQ, allowed_arches);


Thoughts?

Comment 2 Fedora End Of Life 2018-02-20 15:34:08 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 28 development cycle.
Changing version to '28'.

Comment 3 Jan Kurik 2018-08-14 10:17:40 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 29 development cycle.
Changing version to '29'.

Comment 4 Jaroslav Mracek 2018-09-27 10:15:12 UTC
The similar problem we used to have with src arch. Now they are filtered out using with_src=false.

Please is still your request relevant?

Comment 5 Alex Kanavin 2018-09-28 09:06:01 UTC
Not really relevant anymore. We have meanwhile implemented repo setup in such a way that packages with incorrect architectures never make it to the repo (via whitelisting). So there's no way to even easily verify this anymore.

Comment 6 Jaroslav Mracek 2018-09-30 17:05:48 UTC
Thanks a lot for response.


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