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

Zdenek Pavlas zpavlas at redhat.com
Mon Jun 3 07:36:02 UTC 2013


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).
---
 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'):
+                # Using the root cache RDONLY, don't lock.
                 return
             root = self.conf.cachedir
             # Don't want <cachedir>/var/run/yum.pid ... just: <cachedir>/yum.pid
-- 
1.7.11.7



More information about the Yum-devel mailing list