From 8c47021ec3d57601d0df55eed186a1ab94fd28e8 Mon Sep 17 00:00:00 2001 From: Juan RP 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/NEWS b/NEWS index 486fc271..189fbd66 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ xbps-0.33 (???): + * Fixed issue #31: https://github.com/voidlinux/xbps/issues/31 + * New configuration file format with a custom C parser, simpler and does not need any additional external dependency. confuse is not necessary anymore. diff --git a/lib/package_unpack.c b/lib/package_unpack.c index 84565af6..d935ef59 100644 --- a/lib/package_unpack.c +++ b/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 55484941..73610660 100644 --- a/tests/xbps/libxbps/common/Kyuafile +++ b/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 2c6fe259..e0ef1ea2 100644 --- a/tests/xbps/libxbps/shell/Makefile +++ b/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 00000000..83eeaad9 --- /dev/null +++ b/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 +}