mkdir -p $(dirname "${TARGET}")
touch "${TARGET}"
ln -s foo "${TESTDIR}/baz"
-setfacl --default --modify user:${USERS[0]}:rw "${TESTDIR}/foo"
+setfacl --default --modify user:${USERS[0]}:rw $(dirname "${TARGET}")
pushd "${TESTDIR}/baz" > /dev/null
"${BIN}" bar
popd > /dev/null
EOF
)
compare
+
+
+# Ensure that symlinks in non-terminal path components are not followed.
+TESTNUM=32
+TARGET="${TESTDIR}/foo/bar/baz"
+LINK2FOO="${TESTDIR}/quux"
+mkdir -p $(dirname "${TARGET}")
+touch "${TARGET}"
+ln -s foo "${LINK2FOO}"
+setfacl --default --modify user:${USERS[0]}:rw $(dirname "${TARGET}")
+"${BIN}" "${LINK2FOO}/bar/baz"
+ACTUAL=$( getfacl --omit-header "${TARGET}" )
+EXPECTED=$(cat <<EOF
+user::rw-
+group::r--
+other::r--
+
+EOF
+)
+compare