Diff options
Diffstat (limited to '')
-rwxr-xr-xtests/t0302-home-access.sh20
1 file changed, 5 insertions, 15 deletions
diff --git a/tests/t0302-home-access.sh b/tests/t0302-home-access.sh
index e0da1f2..e6faa45 100755
--- a/tests/t0302-home-access.sh
+++ b/tests/t0302-home-access.sh
@@ -3,8 +3,9 @@
# Guards the promise that cgit reads nothing out of the home directory of
# whichever account the web server happens to run as. Every page is fetched
# under strace with HOME pointed at a path that is known not to exist, and
-# the run fails if any access call names that path, which is how a stray
-# read of a personal gitconfig would show up.
+# the run fails if any call taking a path names it, which is how a stray
+# read of a personal gitconfig would show up. The whole file class is traced
+# rather than access alone, which is no syscall of its own on arm64.
test_description='Ensure that git does not access $HOME'
. ./setup.sh
@@ -15,31 +16,20 @@ test_description='Ensure that git does not access $HOME'
command -v strace >/dev/null 2>&1 || {
skip_all='Skipping access validation tests: strace not found'
test_done
- exit
}
strace true 2>/dev/null || {
skip_all='Skipping access validation tests: strace not functional'
test_done
- exit
}
test_no_home_access() {
- # A home that happened to exist would be one git may legitimately
- # read, leaving the check below with nothing to catch, so extend the
- # path until nothing is there.
- missing_home="/path/to/some/place/that/does/not/possibly/exist"
- depth=0
- while test -d "$missing_home"
- do
- depth=$((depth + 1))
- missing_home="$missing_home/$depth"
- done &&
+ missing_home=/path/to/some/place/that/does/not/possibly/exist &&
strace \
-E HOME="$missing_home" \
-E CGIT_CONFIG="$PWD/cgitrc" \
-E QUERY_STRING="url=$1" \
- -e access -f -o strace.out cgit &&
+ -e trace=%file -f -o strace.out cgit &&
! grep "$missing_home" strace.out
}