libalpm/package.c : fix infolevel bug in pkg_dup

The pkg_dup function shouldn't call any alpm_pkg_get_ accessors because
this can fill the old package with all INFRQ_DESC fields for example, and
this won't necessarily be reproduced in the new package (for all the fields
that were copied before).

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Xavier Chantry 2008-07-25 02:02:17 +02:00 committed by Dan McGee
parent c317222d71
commit 310b13a4b7

View file

@ -766,19 +766,18 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg)
newpkg->force = pkg->force; newpkg->force = pkg->force;
newpkg->reason = pkg->reason; newpkg->reason = pkg->reason;
newpkg->licenses = alpm_list_strdup(alpm_pkg_get_licenses(pkg)); newpkg->licenses = alpm_list_strdup(pkg->licenses);
newpkg->replaces = alpm_list_strdup(alpm_pkg_get_replaces(pkg)); newpkg->replaces = alpm_list_strdup(pkg->replaces);
newpkg->groups = alpm_list_strdup(alpm_pkg_get_groups(pkg)); newpkg->groups = alpm_list_strdup(pkg->groups);
newpkg->files = alpm_list_strdup(alpm_pkg_get_files(pkg)); newpkg->files = alpm_list_strdup(pkg->files);
newpkg->backup = alpm_list_strdup(alpm_pkg_get_backup(pkg)); newpkg->backup = alpm_list_strdup(pkg->backup);
for(i = alpm_pkg_get_depends(pkg); i; i = alpm_list_next(i)) { for(i = pkg->depends; i; i = alpm_list_next(i)) {
newpkg->depends = alpm_list_add(newpkg->depends, _alpm_dep_dup(i->data)); newpkg->depends = alpm_list_add(newpkg->depends, _alpm_dep_dup(i->data));
} }
newpkg->optdepends = alpm_list_strdup(alpm_pkg_get_optdepends(pkg)); newpkg->optdepends = alpm_list_strdup(pkg->optdepends);
newpkg->conflicts = alpm_list_strdup(alpm_pkg_get_conflicts(pkg)); newpkg->conflicts = alpm_list_strdup(pkg->conflicts);
newpkg->provides = alpm_list_strdup(alpm_pkg_get_provides(pkg)); newpkg->provides = alpm_list_strdup(pkg->provides);
newpkg->deltas = alpm_list_copy_data(alpm_pkg_get_deltas(pkg), newpkg->deltas = alpm_list_copy_data(pkg->deltas, sizeof(pmdelta_t));
sizeof(pmdelta_t));
/* internal */ /* internal */
newpkg->origin = pkg->origin; newpkg->origin = pkg->origin;