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

log: Preserve log messages during RPM transaction #1772

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

m-blaha
Copy link
Member

@m-blaha m-blaha commented Oct 11, 2024

There is an issue with RotatingFileLogger where log messages during an
RPM transaction in installroot fail to be recorded. When RPM enters a
chroot environment during the transaction, the path resolution changes,
and RotatingFileLogger attempts to reopen the log file from its disk
path for each message. However, once inside the chroot, the log file
path can no longer be resolved, leading to a failure in logging until
the RPM transaction completes.

This patch modifies the RotatingFileLogger behavior to keep the log file
descriptor open, ensuring continuous logging throughout the RPM
transaction.

Resolves: #1717

There is an issue with RotatingFileLogger where log messages during an
RPM transaction in installroot fail to be recorded. When RPM enters a
chroot environment during the transaction, the path resolution changes,
and RotatingFileLogger attempts to reopen the log file from its disk
path for each message. However, once inside the chroot, the log file
path can no longer be resolved, leading to a failure in logging until
the RPM transaction completes.

This patch modifies the RotatingFileLogger behavior to keep the log file
descriptor open, ensuring continuous logging throughout the RPM
transaction.
Copy link
Contributor

@jrohel jrohel left a comment

Choose a reason for hiding this comment

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

There is still a problem if there is a nested installroot with the same path in installroot.

Example:
dnf5 --installroot=/containers/test upgrade
and there exists /containers/test/containers/test/var/log/ (nested installroot). Messages from rpm callbacks will be logged to the nested installroot.

But in general PR improves the situation.

@jrohel
Copy link
Contributor

jrohel commented Oct 15, 2024

Thanks for the PR. Except for the nested installroot case, PR fixes the logging of RPM callbacks for installroot. I will merge it.

@jrohel jrohel added this pull request to the merge queue Oct 15, 2024
Merged via the queue into main with commit 5268783 Oct 15, 2024
17 of 20 checks passed
@jrohel jrohel deleted the mblaha/rotating-logger branch October 15, 2024 12:26
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.

dnf5 with --installroot does not log rpm transaction messages
2 participants