Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
add: fix inverted logic
Baptiste Daroussin committed 3 years ago
commit 9ca5e55bf78adf6c18e037d45e6e7a739e0a5824
parent cbd6eec
2 files changed +2 -2
modified libpkg/pkg_add.c
@@ -962,7 +962,7 @@ should_append_pkg(pkg_chain_t *localpkgs, struct pkg *p)
	/* only keep the highest version is we fine one */
	tll_foreach(*localpkgs, lp) {
		if (strcmp(lp->item->name, p->name) == 0) {
-
			if (pkg_version_cmp(lp->item->version, p->version) == 1) {
+
			if (pkg_version_cmp(lp->item->version, p->version) == -1) {
				tll_remove_and_free(*localpkgs, lp, pkg_free);
				return (true);
			}
modified tests/frontend/add.sh
@@ -268,7 +268,7 @@ deps {
EOF
	atf_check -o ignore -s exit:0 pkg create -M test.ucl
	atf_check -o ignore -s exit:0 pkg create -M final.ucl
-
	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg test test 2
+
	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg test test 1
	atf_check -o ignore -s exit:0 pkg create -M test.ucl
	atf_check -o "match:.*test-2.*" -e ignore -s exit:0 \
		pkg add final-1.pkg