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

dnf5daemon-server: clean(cache-expire) requires root password #1659

Open
mcrha opened this issue Aug 27, 2024 · 1 comment · May be fixed by #2055
Open

dnf5daemon-server: clean(cache-expire) requires root password #1659

mcrha opened this issue Aug 27, 2024 · 1 comment · May be fixed by #2055

Comments

@mcrha
Copy link
Contributor

mcrha commented Aug 27, 2024

This is with dnf5daemon-server-5.2.5.0-20240827005816.54.gbb826e17.fc39.x86_64 .

Calling org.rpm.dnf.v0.Base::clear('cache-expire') requires admin privileges, which is reflected by a password prompt.

Calling org.rpm.dnf.v0.Base::read_all_repos() does not require admin privileges.

It would be better for both of these to not require admin privileges.

Use case: to simulate dnf update --refresh, I need to call clear() first, followed by read_all_repos(). Calling only the read_all_repos() is not enough when the user of the app wants to force the refresh of the metadata and eventually to find new updates.

The read_all_repos() does modify information about the repositories, similar to the clear(cache-expire), hence it would make sense to not require the admin privileges as well.

I can understand it's hard to distinguish which clear() mode is in use for the polkit rules, thus an alternative would be to add an options argument to the read_all_repos() call and recognize a single option cache-expire or force or similar, to set the cache expiration before the actual read of all the repos.

@mcrha
Copy link
Contributor Author

mcrha commented Aug 27, 2024

While being at it, even better than a simple cache-expire option would be cache-age-secs option, telling the daemon that when the cache is older than cache-age-secs seconds it should be refreshed, where 0 means always refresh, and otherwise do not refresh the cache/metadata.

mcrha added a commit to mcrha/dnf5 that referenced this issue Feb 11, 2025
As long as the cache can be reloaded without admin privileges, it
might be possible to expire it without the privileges too. That way
it's possible to do a full refresh of the repos without admin
privileges.

Fixes rpm-software-management#1659
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants