]> gitweb.michael.orlitzky.com - apply-default-acl.git/commitdiff
Add a test to ensure that symlinks in the CWD don't cause problems.
authorMichael Orlitzky <michael@orlitzky.com>
Mon, 26 Feb 2018 12:39:55 +0000 (07:39 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 26 Feb 2018 19:10:29 +0000 (14:10 -0500)
run-tests.sh

index 7f7ba8fb41f456a54b9155e9aec26640ef285a98..d87c678b811e90ce23bf32514914dbd0c0901460 100755 (executable)
@@ -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 <<EOF
+user::rw-
+user:${USERS[0]}:rw-
+group::r--
+mask::rw-
+other::r--
+
+EOF
+)
+compare