Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnf5 append options functionality is broken #1331

Closed
m-blaha opened this issue Mar 20, 2024 · 6 comments · Fixed by #1495
Closed

dnf5 append options functionality is broken #1331

m-blaha opened this issue Mar 20, 2024 · 6 comments · Fixed by #1495
Assignees
Labels
Priority: MEDIUM Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take

Comments

@m-blaha
Copy link
Member

m-blaha commented Mar 20, 2024

In case you have in dnf.conf:

[main]
excludepkgs=acpi 

but for the current run you want to cancel excludes:


# dnf5 install acpi --exclude=
Updating and loading repositories:
Repositories loaded.
Failed to resolve the transaction:
Argument 'acpi' matches only excluded packages. 

Then dnf5 still uses excludes from the config file. This is basically caused by append options not respecting priorities and config file values were allowed to be added to command line values. The #1314 PR fixes this.

But then there is another problem:

  • to make append options work it is essential to read them in order of priority, from lower to higher. Otherwise the re-setting functionality (using empty element as the first item of new list) cannot work correctly.
  • but dnf5 reads first command line options (high priority) and only later it reads config files (with lower priority)

Possible solutions:

  • create specific subclass of OptionStringList for append options, which will remember all items it was gradually set to with their respective priorities. The get_value() will then walk through this list in correct order and return correct values.
  • read config files in dnf5 before command line options
@m-blaha
Copy link
Member Author

m-blaha commented Mar 20, 2024

There are append options tests available in ci-dnf-stack/dnf-behave-tests/dnf/append_options.feature which should be enabled for dnf5.

@ppisar ppisar added Priority: MEDIUM Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take labels Mar 20, 2024
@ppisar
Copy link
Contributor

ppisar commented Mar 20, 2024

dnf5(8) manual does not document a meaning of --exclude=''. It does so for --setopt only.
Though I confirm the bug.

@m-blaha
Copy link
Member Author

m-blaha commented Mar 20, 2024

Documentation is one of the problems with append options usability - you cannot say (even from config-main.hpp) which options are "append" and which are mere "list" options. And what's append options behavior - like for example that an empty first element (or completely empty value) resets current value.

@j-mracek
Copy link
Member

Adding additional possible solution

Apply some configurations multiple times - it is not nice but functional (DNF4 solution). Basically some configuration must be applied earlier, because it modifies paths for low priority options.

@ppisar
Copy link
Contributor

ppisar commented May 15, 2024

I think I got bitten by this bug:

I have tsflag=nodoc in /etc/dnf/dnf.conf:

# dnf --dump-main-config | grep tsflags
tsflags = nodocs

Then I add "--setopt=tsflags=" option to the command line to reset tsflags (as documented in dnf5(8)). Unexpectedly the nodocs is still enabled:

# dnf --setopt=tsflags= --dump-main-config | grep tsflags
tsflags = nodocs

One could say it's a bug in --dump-main-config which could get evaluated before --setopt. But that's not case, the tsflag remains indeed enabled:

# dnf --setopt=tsflags= --dump-main-config reinstall glib2-doc
[...]
# rpm -qf /usr/share/doc/glib-2.0/index.html
error: file /usr/share/doc/glib-2.0/index.html: No such file or directory

Just to confirm, If I remove the tsflags definition from the configuration file, the documentation file gets installed:

# rpm -qf /usr/share/doc/glib-2.0/index.html
glib2-doc-2.80.2-1.fc41.x86_64

I conclude that "--setopt=tsflags=" does not reset tsflags.

ppisar added a commit to ppisar/libmodulemd that referenced this issue May 15, 2024
We need installing glib2 documentation files for building libmodulemd
documentation.

rpm-software-management/dnf5#1331
ppisar added a commit to fedora-modularity/libmodulemd that referenced this issue May 15, 2024
We need installing glib2 documentation files for building libmodulemd
documentation. DNF5 fails to remove nodocs from configuration-file
tsflags using a command-line option.

rpm-software-management/dnf5#1331
@m-blaha
Copy link
Member Author

m-blaha commented May 15, 2024

@ppisar Yes. I'm already working on a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: MEDIUM Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants