diff options
author | Michael Schroeder <mls@suse.de> | 2009-07-15 17:52:38 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2009-07-15 17:52:38 +0200 |
commit | f24719128aa37dc0d8e3286d2a90590451e34980 (patch) | |
tree | 750082d7a0977361d4ea3e86f5c2e2e32cc79f0a /src/repo_solv.c | |
parent | 081193432f4883a3c34110b2b91ed781617fc1d5 (diff) | |
download | libsolv-f24719128aa37dc0d8e3286d2a90590451e34980.tar.gz libsolv-f24719128aa37dc0d8e3286d2a90590451e34980.tar.bz2 libsolv-f24719128aa37dc0d8e3286d2a90590451e34980.zip |
- check for holes when replacing solvable data
Diffstat (limited to 'src/repo_solv.c')
-rw-r--r-- | src/repo_solv.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/repo_solv.c b/src/repo_solv.c index 3be8dd6..782da10 100644 --- a/src/repo_solv.c +++ b/src/repo_solv.c @@ -462,6 +462,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) { /* this is a stub replace operation */ flags |= REPO_EXTEND_SOLVABLES; + /* use REPO_REUSE_REPODATA hack so that the old repodata is kept */ parent = repo_add_repodata(repo, flags | REPO_REUSE_REPODATA); } @@ -508,10 +509,20 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) pool_debug(pool, SAT_ERROR, "relations are forbidden in a local pool\n"); return SOLV_ERROR_CORRUPT; } - if (parent && numsolv && parent->end - parent->start != numsolv) + if (parent && numsolv) { - pool_debug(pool, SAT_ERROR, "sub-repository solvable number doesn't match main repository (%d - %d)\n", parent->end - parent->start, numsolv); - return SOLV_ERROR_CORRUPT; + /* make sure that we exactly replace the stub repodata */ + if (parent->end - parent->start != numsolv) + { + pool_debug(pool, SAT_ERROR, "sub-repository solvable number doesn't match main repository (%d - %d)\n", parent->end - parent->start, numsolv); + return SOLV_ERROR_CORRUPT; + } + for (i = 0; i < numsolv; i++) + if (pool->solvables[parent->start + i].repo != repo) + { + pool_debug(pool, SAT_ERROR, "main repository contains holes\n"); + return SOLV_ERROR_CORRUPT; + } } /******* Part 1: string IDs *****************************************/ |