libxbps: pkg remove: never remove base symlinks in the root directory.
The /bin, /sbin, /lib, /lib32, /lib64, /var/run symlinks should never be removed in Void, so be safe and ignore the removal of them. Added another test to the testsuite to verify its correctness.
This commit is contained in:
@@ -12,5 +12,6 @@ atf_test_program{name="issue6_test"}
|
||||
atf_test_program{name="issue18_test"}
|
||||
atf_test_program{name="issue20_test"}
|
||||
atf_test_program{name="conf_files_test"}
|
||||
atf_test_program{name="remove_test"}
|
||||
include('find_pkg_orphans/Kyuafile')
|
||||
include('pkgdb/Kyuafile')
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
TOPDIR = ../../../..
|
||||
-include $(TOPDIR)/config.mk
|
||||
|
||||
TESTSHELL = conf_files_test issue6_test issue18_test issue20_test
|
||||
TESTSHELL = conf_files_test issue6_test issue18_test issue20_test remove_test
|
||||
|
||||
include ../Makefile.inc
|
||||
include $(TOPDIR)/mk/test.mk
|
||||
|
||||
37
tests/xbps/libxbps/shell/remove_test.sh
Normal file
37
tests/xbps/libxbps/shell/remove_test.sh
Normal file
@@ -0,0 +1,37 @@
|
||||
#! /usr/bin/env atf-sh
|
||||
|
||||
# 1st test: make sure that base symlinks on rootdir are not removed.
|
||||
atf_test_case keep_base_symlinks
|
||||
|
||||
keep_base_symlinks_head() {
|
||||
atf_set "descr" "Tests for package removal: keep base symlinks test"
|
||||
}
|
||||
|
||||
keep_base_symlinks_body() {
|
||||
mkdir -p root/usr/bin
|
||||
ln -sfr root/usr/bin root/bin
|
||||
|
||||
mkdir some_repo
|
||||
mkdir -p pkg_A/usr/bin pkg_A/bin
|
||||
touch -f pkg_A/usr/bin/foo
|
||||
cd some_repo
|
||||
xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" ../pkg_A
|
||||
atf_check_equal $? 0
|
||||
xbps-rindex -a *.xbps
|
||||
atf_check_equal $? 0
|
||||
cd ..
|
||||
xbps-install -r root --repository=some_repo -y foo
|
||||
atf_check_equal $? 0
|
||||
xbps-remove -r root -y foo
|
||||
atf_check_equal $? 0
|
||||
if [ -h root/bin ]; then
|
||||
rv=0
|
||||
else
|
||||
rv=1
|
||||
fi
|
||||
atf_check_equal $rv 0
|
||||
}
|
||||
|
||||
atf_init_test_cases() {
|
||||
atf_add_test_case keep_base_symlinks
|
||||
}
|
||||
Reference in New Issue
Block a user