xbps-create: handle correctly another case of relative symlinks.
This commit is contained in:
parent
9c47bc0b1a
commit
69e3a50e75
@ -283,7 +283,7 @@ ftw_cb(const char *fpath, const struct stat *sb, int type, struct FTW *ftwbuf _u
|
|||||||
* Check if symlink is absolute or relative; on the former
|
* Check if symlink is absolute or relative; on the former
|
||||||
* make it absolute for the target object.
|
* make it absolute for the target object.
|
||||||
*/
|
*/
|
||||||
if (strncmp(buf, "../", 3) == 0) {
|
if (strstr(buf, "./")) {
|
||||||
p = realpath(fpath, NULL);
|
p = realpath(fpath, NULL);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
/*
|
/*
|
||||||
|
@ -58,7 +58,36 @@ symlink_relative_target_body() {
|
|||||||
atf_check_equal $rv 0
|
atf_check_equal $rv 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
atf_test_case symlink_relative_target_cwd
|
||||||
|
|
||||||
|
symlink_relative_target_cwd_head() {
|
||||||
|
atf_set "descr" "xbps-create(8): relative symlinks to cwd in destdir must be absolute"
|
||||||
|
}
|
||||||
|
|
||||||
|
symlink_relative_target_cwd_body() {
|
||||||
|
mkdir -p repo pkg_A/usr/include/gsm
|
||||||
|
touch -f pkg_A/usr/include/gsm/gsm.h
|
||||||
|
cd pkg_A/usr/include
|
||||||
|
ln -s ./gsm/gsm.h gsm.h
|
||||||
|
cd ../../../repo
|
||||||
|
xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" ../pkg_A
|
||||||
|
atf_check_equal $? 0
|
||||||
|
cd ..
|
||||||
|
xbps-rindex -d -a repo/*.xbps
|
||||||
|
atf_check_equal $? 0
|
||||||
|
result="$(xbps-query -r root --repository=repo -f foo|tr -d '\n')"
|
||||||
|
expected="/usr/include/gsm/gsm.h/usr/include/gsm.h -> /usr/include/gsm/gsm.h"
|
||||||
|
rv=0
|
||||||
|
if [ "$result" != "$expected" ]; then
|
||||||
|
echo "result: $result"
|
||||||
|
echo "expected: $expected"
|
||||||
|
rv=1
|
||||||
|
fi
|
||||||
|
atf_check_equal $rv 0
|
||||||
|
}
|
||||||
|
|
||||||
atf_init_test_cases() {
|
atf_init_test_cases() {
|
||||||
atf_add_test_case hardlinks_size
|
atf_add_test_case hardlinks_size
|
||||||
atf_add_test_case symlink_relative_target
|
atf_add_test_case symlink_relative_target
|
||||||
|
atf_add_test_case symlink_relative_target_cwd
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user