[Yum-devel] [PATCH] YumRepo.populate(): always decompresses new database

Zdenek Pavlas zpavlas at redhat.com
Mon Jan 14 16:33:08 UTC 2013


There's a race that has showed up in automated tests:

$ createrepo foo && createrepo bar # tiny repos
$ repoquery --repofrompath tmp,file://foo
OK..
$ repoquery --repofrompath tmp,file://bar
Error: Check uncompressed DB failed.

Here foo & bar happen to have the same timestamp, but different sizes.
On the 2nd run, we copy the correct .gz file, but repo_gen_decompress()
skips decompression, because existing uncompressed file has the same
timestamp.
---
 yum/yumRepo.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index 4f5f7a6..02778dd 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -193,6 +193,8 @@ class YumPackageSack(packageSack.PackageSack):
                 if not db_un_fn:
                     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)
                         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