[Yum-devel] [PATCH] Always lock the user cachedir

James Antill james at fedoraproject.org
Mon Jun 3 20:07:42 UTC 2013


On Mon, 2013-06-03 at 09:36 +0200, Zdenek Pavlas wrote:
> Since commit 0f034091e4388026b10ca0ec5c486d0313ca71b8
> users run in user cachedir ALSO when --cacheonly, and
> we should lock.
> 
> Only when setCacheDir() was skipped, we're using the
> root cache (and can't lock anyway, since it's RDONLY).

 On the one hand, this is kind of buggy, on the other doing this means
you can only have one running per. cachedir. Meh. ACK.

> ---
>  yum/__init__.py | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/yum/__init__.py b/yum/__init__.py
> index 8afde56..e906764 100644
> --- a/yum/__init__.py
> +++ b/yum/__init__.py
> @@ -2033,9 +2033,8 @@ much more problems).
>          :raises: :class:`yum.Errors.LockError`
>          """
>          if self.conf.uid != 0:
> -            #  If we are a user, assume we are using the root cache ... so don't
> -            # bother locking.
> -            if self.conf.cache:
> +            if not hasattr(self, '_old_cachedir'):

 This should probably use:

if not os.access(self.conf.cachedir, os.W_OK)



More information about the Yum-devel mailing list