[Yum-devel] [PATCH] obscure locking error https://bugzilla.redhat.com/show_bug.cgi?id=521748

Seth Vidal skvidal at fedoraproject.org
Wed Sep 9 20:22:31 UTC 2009


if, for some reason the lock/pid file can't be created b/c of an oserror
OTHER than 'file exists' then we shouldn't be raising the msg but creating
a new lockerror exception and passing on something like useful information
---
 yum/__init__.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index 8211c70..d13f7a9 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1259,7 +1259,10 @@ class YumBase(depsolve.Depsolve):
                 os.makedirs(lockdir, mode=0755)
             fd = os.open(filename, os.O_EXCL|os.O_CREAT|os.O_WRONLY, mode)    
         except OSError, msg:
-            if not msg.errno == errno.EEXIST: raise 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, contents)
             return 0
         else:
             os.write(fd, contents)
-- 
1.6.2.5



More information about the Yum-devel mailing list