Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Straube <michael.straube@posteo.de>2018-12-14 21:44:24 +0100
committerAllan McRae <allan@archlinux.org>2019-01-04 11:31:55 +1000
commit3a5a0d53bced32b42fd553952c2f74d52981d9ef (patch)
treed5c520c877e4b1559193ffcea63c79e9f1e05ea2 /src
parent984492b92f1b35534adddc24c2439fcdcb9885af (diff)
Move skipping of duplicate sync/remove targets into libalpm
sync: As pointed out by Andrew Gregory there could be an error when adding duplicates if they are two separate packages with the same name. Add a check in alpm_add_pkg() to test whether the duplicate is actually the same package, and if so, log a debug message and return success to skip the package. If the duplicate is a different package return ALPM_ERR_TRANS_DUP_TARGET and treat that error just like any other error in pacman. remove: Change alpm_remove_pkg() to just log a debug message and return success to skip duplicates. Remove the handling of ALPM_ERR_TRANS_DUP_TARGET in pacman. Also fixes FS#49377. Suggested-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Michael Straube <michael.straube@posteo.de> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/remove.c10
-rw-r--r--src/pacman/sync.c11
2 files changed, 4 insertions, 17 deletions
diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index a2269ed8..9d44cf53 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -44,14 +44,8 @@ static int remove_target(const char *target)
if((pkg = alpm_db_get_pkg(db_local, target)) != NULL) {
if(alpm_remove_pkg(config->handle, pkg) == -1) {
alpm_errno_t err = alpm_errno(config->handle);
- if(err == ALPM_ERR_TRANS_DUP_TARGET) {
- /* just skip duplicate targets */
- pm_printf(ALPM_LOG_WARNING, _("skipping target: %s\n"), target);
- return 0;
- } else {
- pm_printf(ALPM_LOG_ERROR, "'%s': %s\n", target, alpm_strerror(err));
- return -1;
- }
+ pm_printf(ALPM_LOG_ERROR, "'%s': %s\n", target, alpm_strerror(err));
+ return -1;
}
config->explicit_removes = alpm_list_add(config->explicit_removes, pkg);
return 0;
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 57677a42..2406fed5 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -521,15 +521,8 @@ static int process_pkg(alpm_pkg_t *pkg)
if(ret == -1) {
alpm_errno_t err = alpm_errno(config->handle);
- if(err == ALPM_ERR_TRANS_DUP_TARGET) {
- /* just skip duplicate targets */
- pm_printf(ALPM_LOG_WARNING, _("skipping target: %s\n"), alpm_pkg_get_name(pkg));
- return 0;
- } else {
- pm_printf(ALPM_LOG_ERROR, "'%s': %s\n", alpm_pkg_get_name(pkg),
- alpm_strerror(err));
- return 1;
- }
+ pm_printf(ALPM_LOG_ERROR, "'%s': %s\n", alpm_pkg_get_name(pkg), alpm_strerror(err));
+ return 1;
}
config->explicit_adds = alpm_list_add(config->explicit_adds, pkg);
return 0;