[pacman-dev] [PATCH] Fix a serious bug in the download code
After commit df99495b82 pacman downloaded files from the first repo only, and reported corrupted packages for all files from other repos. The download_size was set to 0 for _all_ transaction packages after downloading some files from the first repo. This code-block was moved to its correct place. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> --- lib/libalpm/sync.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 6bc0b37..6b625ed 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -857,12 +857,6 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data) EVENT(trans, PM_TRANS_EVT_RETRIEVE_START, current->treename, NULL); errors = _alpm_download_files(files, current->servers, cachedir); - for(j = trans->add; j; j = j->next) { - pmpkg_t *pkg = j->data; - pkg->infolevel &= ~INFRQ_DSIZE; - pkg->download_size = 0; - } - if (errors) { _alpm_log(PM_LOG_WARNING, _("failed to retrieve some files from %s\n"), current->treename); @@ -875,6 +869,12 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data) } } + for(j = trans->add; j; j = j->next) { + pmpkg_t *pkg = j->data; + pkg->infolevel &= ~INFRQ_DSIZE; + pkg->download_size = 0; + } + /* clear out value to let callback know we are done */ if(handle->totaldlcb) { handle->totaldlcb(0); -- 1.7.1
On Fri, May 14, 2010 at 2:58 PM, Nagy Gabor <ngaba@bibl.u-szeged.hu> wrote:
After commit df99495b82 pacman downloaded files from the first repo only, and reported corrupted packages for all files from other repos.
The download_size was set to 0 for _all_ transaction packages after downloading some files from the first repo. This code-block was moved to its correct place.
Thank you for catching and fixing this.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> --- lib/libalpm/sync.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 6bc0b37..6b625ed 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -857,12 +857,6 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data) EVENT(trans, PM_TRANS_EVT_RETRIEVE_START, current->treename, NULL); errors = _alpm_download_files(files, current->servers, cachedir);
- for(j = trans->add; j; j = j->next) { - pmpkg_t *pkg = j->data; - pkg->infolevel &= ~INFRQ_DSIZE; - pkg->download_size = 0; - } - if (errors) { _alpm_log(PM_LOG_WARNING, _("failed to retrieve some files from %s\n"), current->treename); @@ -875,6 +869,12 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data) } }
+ for(j = trans->add; j; j = j->next) { + pmpkg_t *pkg = j->data; + pkg->infolevel &= ~INFRQ_DSIZE; + pkg->download_size = 0; + } + /* clear out value to let callback know we are done */ if(handle->totaldlcb) { handle->totaldlcb(0); -- 1.7.1
On Fri, 2010-05-14 at 21:58 +0200, Nagy Gabor wrote:
After commit df99495b82 pacman downloaded files from the first repo only, and reported corrupted packages for all files from other repos.
The download_size was set to 0 for _all_ transaction packages after downloading some files from the first repo. This code-block was moved to its correct place.
Yikes, sorry about that :S. Hopefully my next patch will be in better shape...
participants (3)
-
Dan McGee
-
Jonathan Conder
-
Nagy Gabor