[yum-commits] yum/yumRepo.py

zpavlas at osuosl.org zpavlas at osuosl.org
Thu Jan 17 12:36:58 UTC 2013


 yum/yumRepo.py |    2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 1ae97b4786c97d009a0e6a2e7aaeb4b91dbe3572
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Mon Jan 14 17:17:36 2013 +0100

    YumRepo.populate(): always decompresses new database
    
    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.
    Repoquery copies the new .bz2 file, but repo_gen_decompress() skips
    decompression because old uncompressed file has the same timestamp.

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?


More information about the Yum-commits mailing list