From 95356899dfc03215a775868b77d4d1bcb5613027 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 26 Feb 2018 07:39:55 -0500 Subject: [PATCH] Add a test to ensure that symlinks in the CWD don't cause problems. --- run-tests.sh | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/run-tests.sh b/run-tests.sh index 7f7ba8f..d87c678 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -32,7 +32,7 @@ for idx in $( seq 0 $((${#USERS[@]} - 1)) ); do done # The program name. -BIN=src/apply-default-acl +BIN=$(realpath src/apply-default-acl) # The directory where we'll do all the ACL manipulation. TESTDIR=test @@ -749,3 +749,29 @@ other::r-- EOF ) compare + + +# We should be able to run the tool with a relative path from within a +# directory that contains a symlink, so long as the relative path +# doesn't contain one. +TESTNUM=31 +TARGET="${TESTDIR}/foo/bar" +LINK2TARGET="${TESTDIR}/baz" +mkdir -p $(dirname "${TARGET}") +touch "${TARGET}" +ln -s foo "${TESTDIR}/baz" +setfacl --default --modify user:${USERS[0]}:rw "${TESTDIR}/foo" +pushd "${TESTDIR}/baz" > /dev/null +"${BIN}" bar +popd > /dev/null +ACTUAL=$( getfacl --omit-header "${TARGET}" ) +EXPECTED=$(cat <