[Yum-devel] [PATCH] Fix locking issue. BZ 865601

Zdeněk Pavlas zpavlas at redhat.com
Fri Dec 14 10:03:37 UTC 2012


We should retry on EEXISTS only, all other errors are permanent.
LockError(pid=our_pid) only confuses the caller.
---
 yum/__init__.py |    3 +--
 yummain.py      |    2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index 2a82f97..68e3ed3 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2050,8 +2050,7 @@ much more problems).
         except OSError, msg:
             if not msg.errno == errno.EEXIST: 
                 # Whoa. What the heck happened?
-                errmsg = _('Could not create lock at %s: %s ') % (filename, str(msg))
-                raise Errors.LockError(msg.errno, errmsg, int(contents))
+                raise
             return 0
     
     @staticmethod
diff --git a/yummain.py b/yummain.py
index a11f26e..a0e91a2 100755
--- a/yummain.py
+++ b/yummain.py
@@ -124,6 +124,8 @@ def main(args):
     while True:
         try:
             base.doLock()
+        except (OSError, IOError), e:
+            return exIOError(e)
         except Errors.LockError, e:
             if exception2msg(e) != lockerr:
                 lockerr = exception2msg(e)
-- 
1.7.4.4



More information about the Yum-devel mailing list