Fix dnf shell bug#2315
Conversation
When dependency resolution fails in DNF shell mode, errors are only
printed to stdout without proper logging, and users don't receive
actionable suggestions to resolve the issue. Additionally, the shell
continues execution even after resolve failure.
This patch adds:
- Proper error logging via ex_Error() function
- Contextual suggestions based on the error type:
* --allowerasing for conflicting packages
* --skip-broken when strict mode is enabled
* --nobest when best-only candidates fail
* --setopt=optional_metadata_types=filelists for file dependency issues
- Prevents shell from continuing after resolve failure
= changelog =
msg: shell: Provide helpful suggestions when dependency resolution fails
type: enhancement
resolves: rpm-software-management#2314
ppisar
left a comment
There was a problem hiding this comment.
While this code might work, I'm against it, from a conceptual point of view: dnf shell is an interactive Python session for debugging and meddling with the internal implementation. It's not intended for general use and thus adding "helpfull hints" to the error messages is not welcome.
|
DNF team discussed this pull request and concluded that enhancing dnf shell like that is not a problem. I will review the code from functional point of view and provide a feed feedback. |
|
The code does not stop processing when a dependency error is encountered. Having this script: The output looks like this: As you can see it continues evaluating |
Summary
Improves error handling and user feedback in DNF shell when dependency resolution fails.
Problem
Currently, when dependency resolution fails in DNF shell mode:
This makes troubleshooting dependency issues in shell mode much harder compared to regular DNF command mode.
Solution
This PR adds:
ex_Error()function--allowerasingfor conflicting packages--skip-brokenwhen strict mode is enabled--nobestwhen best-only candidates fail--setopt=optional_metadata_types=filelistsfor file dependency issuesTesting
Files Changed
dnf/cli/commands/shell.py- Added error handling and user feedback.dnf/AUTHORS- Added Suresh Jagtap in AUTHORS.