Fix double filelist issue when upgrading a package
commit33240e87b99e5aebd0e64a672ea307a698edb32f
authorDan McGee <dan@archlinux.org>
Wed, 12 Jan 2011 00:46:10 +0000 (11 18:46 -0600)
committerDan McGee <dan@archlinux.org>
Wed, 12 Jan 2011 03:16:39 +0000 (11 21:16 -0600)
treed7fbdc34b44c2cf003d35c6e39c360012be51138
parentb04a56dbe90f43622158410234fabea96d0d7f07
Fix double filelist issue when upgrading a package

Due to the way we funk around with package data loading, we had a condition
where the filelist got doubled up because it was loaded twice.

Packages are originally loaded with INFRQ_BASE. In an upgrade/sync, the
package is checked for file conflicts next, leaving us in an "INFRQ_BASE |
INFRQ_FILES" state. Later, when committing a single package, we have an
explicit call to _alpm_local_db_read() with INFRQ_ALL as the level. Because
the package's level did not match this, we skipped over our previous "does
the incoming level match where I'm at" shortcut, and continued to load
things again, because of a lack of fine-grained checking for each of DESC,
FILES, and INSTALL.

The end result is we loaded the filelist twice, causing our remove logic to
iterate twice over the installed files, spewing a bunch of "cannot find file
X" messages.

Fix the problem by doing a bit more bitmasking logic throughout the load
method, and also fix the sanity check at the beginning of the function- this
should *only* be used for local packages as opposed to the "not a package"
check that was there before.

A debug log message was added to upgraderemove as well to match the one
already in the normal remove codepath.

Signed-off-by: Dan McGee <dan@archlinux.org>
lib/libalpm/be_local.c
lib/libalpm/remove.c