Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/tests/sys/vfs/trailing_slash.sh
39564 views
1
#!/bin/sh
2
#
3
#
4
# Tests vfs_lookup()'s handling of trailing slashes for symlinks that
5
# point to files. See kern/21768 for details. Fixed in r193028.
6
#
7
8
: ${TMPDIR=/tmp}
9
testfile="$TMPDIR/testfile-$$"
10
testlink="$TMPDIR/testlink-$$"
11
12
tests="
13
$testfile:$testlink:$testfile:0
14
$testfile:$testlink:$testfile/:1
15
$testfile:$testlink:$testlink:0
16
$testfile:$testlink:$testlink/:1
17
$testfile/:$testlink:$testlink:1
18
$testfile/:$testlink:$testlink/:1
19
"
20
21
touch $testfile || exit 1
22
trap "rm $testfile $testlink" EXIT
23
24
set $tests
25
echo "1..$#"
26
n=1
27
for testspec ; do
28
(
29
IFS=:
30
set $testspec
31
unset IFS
32
ln -fs "$1" "$2" || exit 1
33
cat "$3" >/dev/null 2>&1
34
ret=$?
35
if [ "$ret" -eq "$4" ] ; then
36
echo "ok $n"
37
else
38
echo "fail $n - expected $4, got $ret"
39
fi
40
)
41
n=$((n+1))
42
done
43
44