Use StdCStreamLogger when DNF5_LOGGER_FILENAME isn't readable #2590
+11
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When filesystem is read-only or the logger file not writable for some reason, we can switch to StdCStreamLogger to keep DNF5 working.
I was trying to fix this bug: https://bugzilla.redhat.com/show_bug.cgi?id=2164380
but then I also noticed this one - https://bugzilla.redhat.com/show_bug.cgi?id=1708166 which sounds very similar.
I'm not sure if StdCStreamLogger is a good choice. I saw there is NullLogger as well which can be an option but I wanted to keep logs even if file system is read-only.
To reproduce this issue you can follow either recommendation from Petr in this bugzilla bug.
I was able to reproduce it with Podman like this:
toolbox create -r f44for other experiments)dnf builddep dnf5.specin this new container to install all needed dependenciespodman commit container_id dnf5:latestThen use these commands (copy pasting from my notes). 487 is container id I have, yours will be different of course.
dnf5 history list- won't run on read only filesystem in the main branch but runs well with this change.Do you guys think it's good enough change? Should we log something like "Log file is not writable. Log information will be printed on screen" when we switch to StdCStreamLogger?