[Yum-devel] [PATCH] fix a race in _getRepos(). BZ 860022

James Antill james at fedoraproject.org
Fri Dec 21 17:01:48 UTC 2012


On Wed, 2012-12-19 at 14:01 +0100, Zdeněk Pavlas wrote:
> ---
>  yum/__init__.py |   12 +++++++-----
>  1 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/yum/__init__.py b/yum/__init__.py
> index 2a82f97..69cfd3c 100644
> --- a/yum/__init__.py
> +++ b/yum/__init__.py
> @@ -672,7 +672,12 @@ class YumBase(depsolve.Depsolve):
>  
>      def _getRepos(self, thisrepo=None, doSetup = False):
>          """ For each enabled repository set up the basics of the repository. """
> -        if hasattr(self, 'prerepoconf'):
> +
> +        # Anaconda calls this in multiple threads, without proper locking.
> +        # Make sure test-and-delete of 'preconf' attribute is atomic.
> +        # BZ 860022.
> +        prerepoconf = self.__dict__.pop('prerepoconf', None)
> +        if prerepoconf:
>              self.conf # touch the config class first

 NAK. I'd firmly put this in the "Dr. it hurts when I..."
 Calling yum APIs from multiple threads is just going to create a bad
time for everyone ... and the above doesn't realistically make the API
any safer.
 The anaconda fix is much better:

https://bugzilla.redhat.com/show_bug.cgi?id=860022#c25



More information about the Yum-devel mailing list