diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2016-02-22 03:46:35 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2016-02-23 03:15:43 +0100 |
commit | 2ee7a8d89ad693617307260604e1d58757fd2978 (patch) | |
tree | 4168d3e07cd4a8ebe21180ac8bc0e27fb05821dd /lib/libalpm/sync.c | |
parent | f63854fa96f658ca5bdf2c21a1cd33cf4e3fbdbd (diff) | |
download | pacman-2ee7a8d89ad693617307260604e1d58757fd2978.tar.gz pacman-2ee7a8d89ad693617307260604e1d58757fd2978.tar.xz |
do not rely on localdb for hook matching
Relying on localdb to determine which trigger operations should match is
completely broken for PostTransaction hooks because the localdb has
already been updated. Store a copy of the old version of any packages
being updated to use instead.
Fixes FS#47996
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/sync.c')
-rw-r--r-- | lib/libalpm/sync.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 3d3915c3..00b68d05 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -659,10 +659,15 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) for(i = trans->add; i; i = i->next) { /* update download size field */ alpm_pkg_t *spkg = i->data; + alpm_pkg_t *lpkg = alpm_db_get_pkg(handle->db_local, spkg->name); if(compute_download_size(spkg) < 0) { ret = -1; goto cleanup; } + if(lpkg && _alpm_pkg_dup(lpkg, &spkg->oldpkg) != 0) { + ret = -1; + goto cleanup; + } } cleanup: @@ -1260,6 +1265,9 @@ static int load_packages(alpm_handle_t *handle, alpm_list_t **data, pkgfile->reason = spkg->reason; /* copy over validation method */ pkgfile->validation = spkg->validation; + /* transfer oldpkg */ + pkgfile->oldpkg = spkg->oldpkg; + spkg->oldpkg = NULL; i->data = pkgfile; /* spkg has been removed from the target list, so we can free the * sync-specific fields */ |