Fix #20 and added an ATF test-case.
This commit is contained in:
parent
10438e58f8
commit
c1fafcd339
2
NEWS
2
NEWS
@ -1,5 +1,7 @@
|
|||||||
xbps-0.27 (???):
|
xbps-0.27 (???):
|
||||||
|
|
||||||
|
* Fixed issue #20: https://github.com/xtraeme/xbps/issues/20
|
||||||
|
|
||||||
* Fixed issue #19: https://github.com/xtraeme/xbps/issues/19
|
* Fixed issue #19: https://github.com/xtraeme/xbps/issues/19
|
||||||
|
|
||||||
* Fixed issue #18: https://github.com/xtraeme/xbps/issues/18
|
* Fixed issue #18: https://github.com/xtraeme/xbps/issues/18
|
||||||
|
@ -368,6 +368,12 @@ unpack_archive(struct xbps_handle *xhp,
|
|||||||
conf_file = skip_extract = file_exists = false;
|
conf_file = skip_extract = file_exists = false;
|
||||||
if (lstat(entry_pname, &st) == 0)
|
if (lstat(entry_pname, &st) == 0)
|
||||||
file_exists = true;
|
file_exists = true;
|
||||||
|
/*
|
||||||
|
* If file to be extracted does not match the file type of
|
||||||
|
* file currently stored on disk, remove file on disk.
|
||||||
|
*/
|
||||||
|
if (file_exists && (entry_type != (int)st.st_mode))
|
||||||
|
remove(entry_pname);
|
||||||
|
|
||||||
if (!force && (entry_type == AE_IFREG)) {
|
if (!force && (entry_type == AE_IFREG)) {
|
||||||
buf = strchr(entry_pname, '.') + 1;
|
buf = strchr(entry_pname, '.') + 1;
|
||||||
|
@ -11,5 +11,6 @@ SUBDIRS += find_pkg_obsoletes
|
|||||||
SUBDIRS += find_pkg_orphans
|
SUBDIRS += find_pkg_orphans
|
||||||
SUBDIRS += pkgdb
|
SUBDIRS += pkgdb
|
||||||
SUBDIRS += issue18
|
SUBDIRS += issue18
|
||||||
|
SUBDIRS += issue20
|
||||||
|
|
||||||
include ../../../mk/subdir.mk
|
include ../../../mk/subdir.mk
|
||||||
|
@ -9,5 +9,6 @@ atf_test_program{name="plist_match_test"}
|
|||||||
atf_test_program{name="plist_match_virtual_test"}
|
atf_test_program{name="plist_match_virtual_test"}
|
||||||
atf_test_program{name="find_pkg_obsoletes_test"}
|
atf_test_program{name="find_pkg_obsoletes_test"}
|
||||||
atf_test_program{name="issue18_test"}
|
atf_test_program{name="issue18_test"}
|
||||||
|
atf_test_program{name="issue20_test"}
|
||||||
include('find_pkg_orphans/Kyuafile')
|
include('find_pkg_orphans/Kyuafile')
|
||||||
include('pkgdb/Kyuafile')
|
include('pkgdb/Kyuafile')
|
||||||
|
7
tests/xbps/libxbps/issue20/Makefile
Normal file
7
tests/xbps/libxbps/issue20/Makefile
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
TOPDIR = ../../../..
|
||||||
|
-include $(TOPDIR)/config.mk
|
||||||
|
|
||||||
|
TEST = issue20_test
|
||||||
|
|
||||||
|
include ../Makefile.inc
|
||||||
|
include $(TOPDIR)/mk/test-shell.mk
|
57
tests/xbps/libxbps/issue20/issue20_test.sh
Normal file
57
tests/xbps/libxbps/issue20/issue20_test.sh
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#! /usr/bin/env atf-sh
|
||||||
|
|
||||||
|
# xbps issue #20.
|
||||||
|
# How to reproduce it:
|
||||||
|
# Create pkg a-0.1_1 containing 1 file and 1 symlink:
|
||||||
|
#
|
||||||
|
# /foo
|
||||||
|
# /blah -> foo
|
||||||
|
#
|
||||||
|
# Create pkg a-0.2_1 containing 1 file and 1 symlink (inverted):
|
||||||
|
#
|
||||||
|
# /foo -> blah
|
||||||
|
# /blah
|
||||||
|
#
|
||||||
|
# Upgrade pkg a to 0.2.
|
||||||
|
|
||||||
|
atf_test_case issue20
|
||||||
|
|
||||||
|
issue20_head() {
|
||||||
|
atf_set "descr" "xbps issue #20 (https://github.com/xtraeme/xbps/issues/18)"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue20_body() {
|
||||||
|
mkdir repo
|
||||||
|
cd repo
|
||||||
|
mkdir pkg_a
|
||||||
|
touch pkg_a/foo
|
||||||
|
ln -sr pkg_a/foo pkg_a/blah
|
||||||
|
xbps-create -A noarch -n a-0.1_1 -s "pkg a" pkg_a
|
||||||
|
atf_check_equal $? 0
|
||||||
|
rm -rf pkg_a
|
||||||
|
xbps-rindex -a *.xbps
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-install -r rootdir --repository=$PWD -y a
|
||||||
|
atf_check_equal $? 0
|
||||||
|
|
||||||
|
mkdir pkg_a
|
||||||
|
touch pkg_a/blah
|
||||||
|
ln -sr pkg_a/blah pkg_a/foo
|
||||||
|
xbps-create -A noarch -n a-0.2_1 -s "pkg a" pkg_a
|
||||||
|
atf_check_equal $? 0
|
||||||
|
rm -rf pkg_a
|
||||||
|
xbps-rindex -a *.xbps
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-install -r rootdir --repository=$PWD -yu
|
||||||
|
atf_check_equal $? 0
|
||||||
|
tgt=$(readlink rootdir/foo)
|
||||||
|
rval=1
|
||||||
|
if [ -f rootdir/blah -a "$tgt" = "blah" ]; then
|
||||||
|
rval=0
|
||||||
|
fi
|
||||||
|
atf_check_equal $rval 0
|
||||||
|
}
|
||||||
|
|
||||||
|
atf_init_test_cases() {
|
||||||
|
atf_add_test_case issue20
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user