xbps: merge 2 patches from master for 2 bugfixes.

This commit is contained in:
Juan RP 2014-10-19 07:37:55 +02:00
parent 15fbcb2b4b
commit c548d1089d
4 changed files with 125 additions and 2 deletions

View file

@ -3,7 +3,7 @@
# NOTE: keep this package synchronized with "srcpkgs/xbps".
pkgname=xbps-static
version=0.41
revision=1
revision=2
bootstrap=yes
short_desc="The XBPS package system utilities - static binaries"
maintainer="Juan RP <xtraeme@gmail.com>"

View file

@ -0,0 +1,31 @@
From 1c20086896215fd6eb8e8ff59a6f98a86024ec20 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Fri, 17 Oct 2014 09:17:07 +0200
Subject: [PATCH 01/13] Package remove: disable file owner checks if euid==0.
All package files even not owned by root should be removed, so make sure
that those checks return success while being root.
This fixes package removal for polkit, that had /etc/polkit/rules.d
files owned by the polkitd user.
---
NEWS | 4 ++++
lib/package_remove.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/package_remove.c b/lib/package_remove.c
index 9c82278..5679fea 100644
--- lib/package_remove.c
+++ lib/package_remove.c
@@ -65,7 +65,7 @@ check_remove_pkg_files(struct xbps_handle *xhp,
* enough to ensure the user has write permissions
* on the directory.
*/
- if (!lstat(path, &st) && euid == st.st_uid) {
+ if (euid == 0 || (!lstat(path, &st) && euid == st.st_uid)) {
/* success */
continue;
}
--
2.1.2

View file

@ -0,0 +1,92 @@
From d7633e88e0bf25cd2c319ac1c0706fe69bfd5885 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Fri, 17 Oct 2014 09:52:32 +0200
Subject: [PATCH 02/13] Fix #62 (Dup replaced pkgs in transaction)
---
NEWS | 3 +++
lib/transaction_package_replace.c | 3 +--
tests/xbps/libxbps/shell/replace_test.sh | 40 ++++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/lib/transaction_package_replace.c b/lib/transaction_package_replace.c
index 56048f8..2eebd51 100644
--- lib/transaction_package_replace.c
+++ lib/transaction_package_replace.c
@@ -103,14 +103,13 @@ xbps_transaction_package_replace(struct xbps_handle *xhp)
*/
xbps_dictionary_get_bool(instd, "automatic-install", &instd_auto);
if ((reppkgd = xbps_find_pkg_in_array(unsorted, curpkgname, NULL))) {
- xbps_dictionary_set_bool(instd,
- "remove-and-update", true);
xbps_dictionary_set_bool(reppkgd,
"automatic-install", instd_auto);
xbps_dictionary_set_bool(reppkgd,
"skip-obsoletes", true);
xbps_array_replace_dict_by_name(unsorted,
reppkgd, curpkgname);
+ continue;
}
/*
* If new package is providing a virtual package to the
diff --git a/tests/xbps/libxbps/shell/replace_test.sh b/tests/xbps/libxbps/shell/replace_test.sh
index 469b7f8..0e54dc2 100644
--- tests/xbps/libxbps/shell/replace_test.sh
+++ tests/xbps/libxbps/shell/replace_test.sh
@@ -37,6 +37,45 @@ replace_dups_body() {
atf_check_equal $(xbps-query -C empty.conf -r root -p state B) installed
}
+atf_test_case replace_ntimes
+
+replace_ntimes_head() {
+ atf_set "descr" "Tests for package replace: replacing installed pkg by multiple pkgs"
+}
+
+replace_ntimes_body() {
+ mkdir some_repo root
+ mkdir -p pkg_{A,B,C,D}/usr/bin
+ cd some_repo
+ xbps-create -A noarch -n A-1.0_1 -s "A pkg" ../pkg_A
+ atf_check_equal $? 0
+ xbps-create -A noarch -n B-1.0_1 -s "B pkg" ../pkg_B
+ atf_check_equal $? 0
+ xbps-create -A noarch -n C-1.0_1 -s "C pkg" ../pkg_C
+ atf_check_equal $? 0
+ xbps-create -A noarch -n D-1.0_1 -s "D pkg" ../pkg_D
+ atf_check_equal $? 0
+ xbps-rindex -a *.xbps
+ atf_check_equal $? 0
+ cd ..
+ xbps-install -C empty.conf -r root --repository=$PWD/some_repo -yd A B C D
+ atf_check_equal $? 0
+ cd some_repo
+ xbps-create -A noarch -n A-1.1_1 -s "A pkg" ../pkg_A
+ atf_check_equal $? 0
+ xbps-create -A noarch -n B-1.1_1 -s "B pkg" --replaces "A<1.1" ../pkg_B
+ atf_check_equal $? 0
+ xbps-create -A noarch -n C-1.1_1 -s "C pkg" --replaces "A<1.1" ../pkg_C
+ atf_check_equal $? 0
+ xbps-create -A noarch -n D-1.1_1 -s "D pkg" --replaces "A<1.1" ../pkg_D
+ atf_check_equal $? 0
+ xbps-rindex -a *.xbps
+ atf_check_equal $? 0
+ cd ..
+ result=$(xbps-install -C empty.conf -r root --repository=$PWD/some_repo -yun|wc -l)
+ atf_check_equal $result 4
+}
+
atf_test_case self_replace
self_replace_head() {
@@ -97,6 +136,7 @@ replace_vpkg_body() {
atf_init_test_cases() {
atf_add_test_case replace_dups
+ atf_add_test_case replace_ntimes
atf_add_test_case replace_vpkg
atf_add_test_case self_replace
}
--
2.1.2

View file

@ -1,7 +1,7 @@
# Template file for 'xbps'
pkgname=xbps
version=0.41
revision=1
revision=2
bootstrap=yes
short_desc="The XBPS package system utilities"
maintainer="Juan RP <xtraeme@gmail.com>"