Bug 1997616 - DNF is not evaluating conditional package-spec properly for "dnf install"
Summary: DNF is not evaluating conditional package-spec properly for "dnf install"
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: rawhide
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: 2021-08-25 14:24 UTC by Neal Gompa
Modified: 2023-06-18 08:08 UTC (History)
12 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2023-06-18 08:08:52 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Fedora Pagure fedora-workstation issue 84 0 None None None 2021-08-25 14:24:42 UTC

Description Neal Gompa 2021-08-25 14:24:43 UTC
Description of problem:
When trying to test conditional installation expressions with "dnf install", it seems like DNF is basically ignoring the expression and requesting to install the package anyway.

In particular, I want to use this for a firstboot service to only install some packages conditionally. In particular, gstreamer1-plugin-openh264 and mozilla-openh264 right now, and possibly third-party hardware drivers in the future.

I vaguely recall that this used to work (I remember using it to test rich dep expressions in the past for package development), but it does not work properly now and always requests to install the packages.

Version-Release number of selected component (if applicable):
4.8.0-2.fc35

How reproducible:
Always

Steps to Reproduce:
1. Run "dnf --assumeno install '(gstreamer1-plugin-openh264 if gstreamer1-plugins-base)' '(mozilla-openh264 if mozilla-filesystem)'"

Actual results:
DNF proposes to install gstreamer1-plugin-openh264 and mozilla-openh264.

Expected results:
DNF does not propose to install anything if gstreamer1-plugins-base and mozilla-filesystem are not installed. If gstreamer1-plugins-base is installed, it will propose to install gstreamer1-plugin-openh264. If mozilla-filesystem is installed, it will propose to install mozilla-openh264. If both are installed, then it'll propose to install gstreamer1-plugin-openh264 and mozilla-openh264.

Additional info:
We want to use this for auto-installing OpenH264 in desktop Fedora variants after initial installation.

See https://pagure.io/fedora-workstation/issue/84 for more details.

Comment 1 Jaroslav Mracek 2021-08-31 07:03:08 UTC
Thanks for the report. The problem is related to how we resolve arguments from commandline to packages in first place and then we ask to install those packages. We can improve it and try something like: when arguments start with '(' then do goal install provide of argument. This approach has some disadvantages. It will not work for globs and when multiarch_policy=all, because it will install only one architecture. Also there will be a problem with reports of no much found, but it can be workarrounded by creating query like always, but result will be used only for report and not for goal.

Anyway the request is valid but I would prefer to resolve it in DNF5.

Comment 2 Ben Cotton 2022-02-08 20:27:19 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.

Comment 3 Ben Cotton 2023-04-25 16:43:56 UTC
This message is a reminder that Fedora Linux 36 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 36 on 2023-05-16.
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
'version' of '36'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 36 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 Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 4 Jaroslav Mracek 2023-06-18 08:08:52 UTC
The issue is fixed in DNF5 for install command (only). DNF5 is available in Fedora 38+ therefore I consider the request as resolved. We don't have a plan to provide a patch for DNF4 therefore I am closing the bug.


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