[Yum-devel] [PATCH] fix --cacheonly edge case. BZ 975619

Zdenek Pavlas zpavlas at redhat.com
Wed Jun 19 07:30:34 UTC 2013


When cacheonly and MD are not present/valid, we usually
raise RepoError right in _retrieveMD().  But when the
*compressed* file is valid, we try decompressing it.
Make it fail in the expected way few lines below.
---
 yum/yumRepo.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index cfe7b05..e217c57 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -234,7 +234,8 @@ class YumPackageSack(packageSack.PackageSack):
                     db_fn = repo._retrieveMD(mydbtype)
                     if db_fn:
                         # unlink the decompressed file, we know it's not valid
-                        misc.unlink_f(repo.cachedir +'/gen/%s.sqlite' % mydbtype)
+                        try: os.unlink(repo.cachedir +'/gen/%s.sqlite' % mydbtype)
+                        except OSError: pass
                         db_un_fn = self._check_uncompressed_db_gen(repo,
                                                                    mydbtype)
                     if not db_un_fn: # Shouldn't happen?
-- 
1.7.11.7



More information about the Yum-devel mailing list