From c913c53322a7bd4a006a905df4087092a0630ab4 Mon Sep 17 00:00:00 2001 From: Chantry Xavier Date: Sat, 22 Dec 2007 20:54:01 +0100 Subject: libalpm/add.c: disable buggy backup handling code that didn't do anything. As I mentioned earlier on the ML : http://www.archlinux.org/pipermail/pacman-dev/2007-December/010416.html the first part of commit 843d368ef6 had no effect because of a bug. So I fixed the bug, but since this would change backup handling behavior, and possibly require other bigger changes to work right, I decided to just disable that part temporarily, and left a TODO in the code. Signed-off-by: Chantry Xavier Signed-off-by: Dan McGee --- lib/libalpm/add.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 11c5eb8c..292a0111 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -234,26 +234,37 @@ static int upgrade_remove(pmpkg_t *oldpkg, pmpkg_t *newpkg, pmtrans_t *trans, pm tr->skip_remove = alpm_list_strdup(trans->skip_remove); const alpm_list_t *b; - /* Add files in the OLD and NEW backup array to the NoUpgrade array + /* Add files in the NEW backup array to the NoUpgrade array * so this removal operation doesn't kill them */ alpm_list_t *old_noupgrade = alpm_list_strdup(handle->noupgrade); /* old package backup list */ - for(b = alpm_pkg_get_backup(oldpkg); b; b = b->next) { - const char *backup = b->data; + for(b = alpm_pkg_get_backup(newpkg); b; b = b->next) { + char *backup = _alpm_backup_file(b->data); _alpm_log(PM_LOG_DEBUG, "adding %s to the NoUpgrade array temporarily\n", backup); - handle->noupgrade = alpm_list_add(handle->noupgrade, strdup(backup)); + handle->noupgrade = alpm_list_add(handle->noupgrade, + backup); } + + /* TODO: we could also add files in the OLD backup array, but this would + * change the backup handling behavior, and break several pactests, and we + * can't do this just before 3.1 release. + * The unlink_file function in remove.c would also need to be reviewed. */ +#if 0 /* new package backup list */ - for(b = alpm_pkg_get_backup(newpkg); b; b = b->next) { - const char *backup = b->data; + for(b = alpm_pkg_get_backup(oldpkg); b; b = b->next) { + char *backup = _alpm_backup_file(b->data); /* make sure we don't add duplicate entries */ if(!alpm_list_find_ptr(handle->noupgrade, backup)) { _alpm_log(PM_LOG_DEBUG, "adding %s to the NoUpgrade array temporarily\n", backup); - handle->noupgrade = alpm_list_add(handle->noupgrade, strdup(backup)); + handle->noupgrade = alpm_list_add(handle->noupgrade, + _alpm_backup_file(backup)); + handle->noupgrade = alpm_list_add(handle->noupgrade, + backup); } } +#endif int ret = _alpm_remove_commit(tr, db); -- cgit v1.2.3-70-g09d2