2022-05-25 14:02:09 +00:00
|
|
|
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
export LC_ALL=C.UTF-8
|
|
|
|
mkfifo /tmp/myfifo
|
|
|
|
mkdir /tmp/root
|
|
|
|
ln -s /real /tmp/root/link
|
|
|
|
mkdir /tmp/root/real
|
|
|
|
run_testA() {
|
|
|
|
echo content > /tmp/foo
|
2022-11-16 12:59:38 +00:00
|
|
|
# shellcheck disable=SC2094
|
2023-10-23 08:41:46 +00:00
|
|
|
{ { { {{ CMD }} --hook-helper /tmp/root root setup '' 1 upload /tmp/foo "$1" < /tmp/myfifo 3>&-; echo $? >&3; printf "\\000\\000adios";
|
2022-05-25 14:02:09 +00:00
|
|
|
} | {{ CMD }} --hook-listener 1 3>&- >/tmp/myfifo; echo $?; } 3>&1;
|
2022-11-16 12:59:38 +00:00
|
|
|
} | { read -r xs1; [ "$xs1" -eq 0 ]; read -r xs2; [ "$xs2" -eq 0 ]; }
|
2022-05-25 14:02:09 +00:00
|
|
|
echo content | diff -u - /tmp/root/real/foo
|
|
|
|
rm /tmp/foo
|
|
|
|
rm /tmp/root/real/foo
|
|
|
|
}
|
|
|
|
run_testA link/foo
|
|
|
|
run_testA /link/foo
|
|
|
|
run_testA ///link///foo///
|
|
|
|
run_testA /././link/././foo/././
|
|
|
|
run_testA /link/../link/foo
|
|
|
|
run_testA /link/../../link/foo
|
|
|
|
run_testA /../../link/foo
|
|
|
|
rmdir /tmp/root/real
|
|
|
|
rm /tmp/root/link
|
|
|
|
rmdir /tmp/root
|
|
|
|
rm /tmp/myfifo
|