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

Better error messages for system state loading #1623

Merged
merged 3 commits into from
Aug 22, 2024
Merged

Conversation

m-blaha
Copy link
Member

@m-blaha m-blaha commented Aug 12, 2024

Add a man page on DNF system state. This man page is then referenced in system state loading error messages.

Resolves: #1550

Changes:

ac68a07 (Marek Blaha, 5 days ago)
doc: Add man page describing the system state

The page also contains information how to recover from corrupted system
state files.

888d955 (Marek Blaha, 5 days ago)
state: Catch all errors during system state load

There are multiple exceptions that can occur during loading the system
state from toml files. Now they are caught and wrapped in StateLoadError.

@jan-kolarik jan-kolarik self-assigned this Aug 13, 2024
doc/conf.py.in Show resolved Hide resolved
doc/misc/system-state.7.rst Outdated Show resolved Hide resolved
doc/misc/system-state.7.rst Show resolved Hide resolved
doc/misc/system-state.7.rst Outdated Show resolved Hide resolved
doc/misc/system-state.7.rst Outdated Show resolved Hide resolved
@m-blaha m-blaha force-pushed the mblaha/state-reason branch 3 times, most recently from bfb591a to b04e7c8 Compare August 20, 2024 07:06
@jan-kolarik
Copy link
Member

/packit copr-build

@jan-kolarik
Copy link
Member

Please rebase against the latest changes so we can see the build is OK now. Thanks!

@m-blaha
Copy link
Member Author

m-blaha commented Aug 20, 2024

Done, let's see the results...

Description
===========

The DNF5 system state consists of several TOML files located in the /usr/lib/sysimage/libdnf5/ directory. DNF5 uses the system state to:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The /usr/lib/sysimage/libdnf5/ is the default but I think we should mention that the location is taken from system_state_dir config option.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. I'll fix it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@jan-kolarik
Copy link
Member

jan-kolarik commented Aug 20, 2024

Interestingly, there are some TOML unit tests failing, though after merging the #1625 it was green:

test_state.cpp:111:Assertion
Test name: StateTest::test_state_version
expected exception not thrown
- Expected: libdnf5::system::InvalidVersionError
- Actual  : std::exception or derived
- What()  : Loading system state TOML file /tmp/libdnf_test_state.tXm5yO/packag
es.toml failed (see dnf5-system-state(7)): Invalid TOML version "aaa", "MAJOR.M
INOR" expected

EDIT: Oh I see it's actually related to the PR :)

There are multiple exceptions that can occur during loading the system
state from toml files. Now they are caught and wrapped in
StateLoadError.
The page also contains information how to recover from corrupted system
state files.
@m-blaha
Copy link
Member Author

m-blaha commented Aug 21, 2024

EDIT: Oh I see it's actually related to the PR :)

Fixed.

@jan-kolarik jan-kolarik added this pull request to the merge queue Aug 22, 2024
Merged via the queue into main with commit b1f839c Aug 22, 2024
11 of 20 checks passed
@jan-kolarik jan-kolarik deleted the mblaha/state-reason branch August 22, 2024 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

terminate called after throwing an instance of 'std::out_of_range'
4 participants