diff options
author | Thierry Vignaud <thierry.vignaud@gmail.com> | 2014-10-23 00:23:12 +0200 |
---|---|---|
committer | Thierry Vignaud <thierry.vignaud@gmail.com> | 2014-10-23 00:37:22 +0200 |
commit | 9da52289488329a59123d27dfc90f7b03801e89f (patch) | |
tree | 72f5c5e83c916eb992d1d4ac095232f6ba321526 /README | |
parent | 0f122c39101955dc584fe8e0dacfed17dfc7c831 (diff) | |
download | perl-URPM-9da52289488329a59123d27dfc90f7b03801e89f.tar perl-URPM-9da52289488329a59123d27dfc90f7b03801e89f.tar.gz perl-URPM-9da52289488329a59123d27dfc90f7b03801e89f.tar.bz2 perl-URPM-9da52289488329a59123d27dfc90f7b03801e89f.tar.xz perl-URPM-9da52289488329a59123d27dfc90f7b03801e89f.zip |
fix crashing in ptread when using log callback with rpm-4.12
fix by Panu Matilainen
When rpmlog() occurs, it now grabs a read/write lock on the log context
depending on whether it needs to save the log or not. The callback
executes while the context lock is held, so when one call
rpmlogMessage() or pretty much any rpmlog-related function from the
callback, it'll try to lock the context again. Which is okay as long as
rpmlog() only needed a read-lock on the context. However if it has a
write-lock then attempting to grab a read-lock for rpmlogMessage()
fails, but due to the largely missing error handling in rpmlog.c it
falls through to crash and burn.
The only reason we need to call rpmlogMessage() is that the callback
does not match the callback function type in rpm >= 4.6:
typedef int (*rpmlogCallback) (rpmlogRec rec, rpmlogCallbackData data);
We shouldn't call that from log callback.
We can avoid the issue by using rpmlogRecMessage() instead of
rpmlogMessage() inside the callback. These are not the same,
rpmlogRecMessage() returns the message of the *current* log event,
whereas rpmlogMessage() returns the last *saved* log event. Which might
not exist, might be from an earlier event or it might be the current
event.
...and it'll not only work in all rpm >= 4.6 versions, but also give
the actual log message at hand, instead of something that might have
happened in the past.
Diffstat (limited to 'README')
0 files changed, 0 insertions, 0 deletions