From e1562bab88fd364c9561c1e413ae6c285ac1edeb Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Tue, 19 Jan 2010 14:49:36 +0100 Subject: [PATCH] Evaluate SolvAttr::repositoryToolVersion to prevent loading outdated solv files. --- zypp/RepoManager.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/zypp/RepoManager.cc b/zypp/RepoManager.cc index 66c4a21..7a85ddd 100644 --- a/zypp/RepoManager.cc +++ b/zypp/RepoManager.cc @@ -1304,7 +1304,21 @@ namespace zypp try { - sat::Pool::instance().addRepoSolv( solvfile, info ); + Repository repo = sat::Pool::instance().addRepoSolv( solvfile, info ); + // test toolversion in order to rebuild solv file in case + // it was written by an old satsolver-tool parser. + // + // Known version strings used: + // - + // - "1.0" + // + sat::LookupRepoAttr toolversion( sat::SolvAttr::repositoryToolVersion, repo ); + if ( toolversion.begin().asString().empty() ) + { + repo.eraseFromPool(); + ZYPP_THROW(Exception("Solv-file was created by old parser.")); + } + // else: up-to-date (or even newer). } catch ( const Exception & exp ) { -- 2.7.4