xbps: add patch from git master to fix xbps issue 31.

This commit is contained in:
Juan RP 2014-02-25 22:58:52 +01:00
parent 0edf396f6e
commit dc65cc71bd
2 changed files with 103 additions and 1 deletions

View File

@ -0,0 +1,102 @@
From 8c47021ec3d57601d0df55eed186a1ab94fd28e8 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Tue, 25 Feb 2014 22:55:39 +0100
Subject: [PATCH] Fix #31 and add new test case to reproduce it.
---
NEWS | 2 ++
lib/package_unpack.c | 2 +-
tests/xbps/libxbps/common/Kyuafile | 1 +
tests/xbps/libxbps/shell/Makefile | 1 +
tests/xbps/libxbps/shell/issue31_test.sh | 42 ++++++++++++++++++++++++++++++++
5 files changed, 47 insertions(+), 1 deletion(-)
create mode 100644 tests/xbps/libxbps/shell/issue31_test.sh
diff --git a/lib/package_unpack.c b/lib/package_unpack.c
index 84565af..d935ef5 100644
--- lib/package_unpack.c
+++ lib/package_unpack.c
@@ -364,7 +364,7 @@ unpack_archive(struct xbps_handle *xhp,
if (!force && (entry_type == AE_IFREG)) {
buf = strchr(entry_pname, '.') + 1;
assert(buf != NULL);
- if (file_exists) {
+ if (file_exists && S_ISREG(st.st_mode)) {
/*
* Handle configuration files. Check if current
* entry is a configuration file and take action
diff --git a/tests/xbps/libxbps/common/Kyuafile b/tests/xbps/libxbps/common/Kyuafile
index 5548494..7361066 100644
--- tests/xbps/libxbps/common/Kyuafile
+++ tests/xbps/libxbps/common/Kyuafile
@@ -11,6 +11,7 @@ atf_test_program{name="find_pkg_obsoletes_test"}
atf_test_program{name="issue6_test"}
atf_test_program{name="issue18_test"}
atf_test_program{name="issue20_test"}
+atf_test_program{name="issue31_test"}
atf_test_program{name="conf_files_test"}
atf_test_program{name="remove_test"}
atf_test_program{name="replace_test"}
diff --git a/tests/xbps/libxbps/shell/Makefile b/tests/xbps/libxbps/shell/Makefile
index 2c6fe25..e0ef1ea 100644
--- tests/xbps/libxbps/shell/Makefile
+++ tests/xbps/libxbps/shell/Makefile
@@ -3,6 +3,7 @@ TOPDIR = ../../../..
TESTSHELL = conf_files_test issue6_test issue18_test issue20_test remove_test
TESTSHELL+= replace_test installmode_test obsoletefiles_test
+TESTSHELL+= issue31_test
include ../Makefile.inc
include $(TOPDIR)/mk/test.mk
diff --git a/tests/xbps/libxbps/shell/issue31_test.sh b/tests/xbps/libxbps/shell/issue31_test.sh
new file mode 100644
index 0000000..83eeaad
--- /dev/null
+++ tests/xbps/libxbps/shell/issue31_test.sh
@@ -0,0 +1,42 @@
+#! /usr/bin/env atf-sh
+
+# xbps issue #31.
+# How to reproduce it:
+# Generate pkg A-0.1_1:
+# /dir/dir/foo
+# Install pkg A.
+# Generate pkg A-0.2_1:
+# /dir/foo
+# Update pkg A to 0.2_1
+
+atf_test_case issue31
+
+issue31_head() {
+ atf_set "descr" "xbps issue #31 (https://github.com/xtraeme/xbps/issues/31)"
+}
+
+issue31_body() {
+ mkdir -p pkg_A/usr/share/licenses/chromium/license.html
+ echo random > pkg_A/usr/share/licenses/chromium/license.html/eula.html
+ xbps-create -A noarch -n A-0.1_1 -s "pkg A" pkg_A
+ atf_check_equal $? 0
+ xbps-rindex -a *.xbps
+ atf_check_equal $? 0
+
+ xbps-install -r root -C null.conf --repository=$PWD -y A
+ atf_check_equal $? 0
+
+ mkdir -p pkg_B/usr/share/licenses/chromium
+ echo "morerandom" > pkg_B/usr/share/licenses/chromium/license.html
+ xbps-create -A noarch -n A-0.2_1 -s "pkg A" pkg_B
+ atf_check_equal $? 0
+ xbps-rindex -a A-0.2_1.noarch.xbps
+ atf_check_equal $? 0
+
+ xbps-install -r root -C null.conf --repository=$PWD -yuvd A
+ atf_check_equal $? 0
+}
+
+atf_init_test_cases() {
+ atf_add_test_case issue31
+}
--
1.9.0

View File

@ -1,7 +1,7 @@
# Template file for 'xbps'
pkgname=xbps
version=0.32
revision=1
revision=2
bootstrap=yes
conf_files="/etc/xbps/xbps.conf"
replaces="xbps>=0"