]>
Commit | Line | Data |
---|---|---|
1 | # $FreeBSD$ | |
2 | set -e | |
3 | ||
4 | P=${TMPDIR:-/tmp} | |
5 | cd $P | |
6 | T=$(mktemp -d sh-test.XXXXXX) | |
7 | ||
8 | chmod 0 $T | |
9 | if [ `id -u` -ne 0 ]; then | |
10 | # Root can always cd, regardless of directory permissions. | |
11 | cd -L $T 2>/dev/null && exit 1 | |
12 | [ "$PWD" = "$P" ] | |
13 | [ "$(pwd)" = "$P" ] | |
14 | cd -P $T 2>/dev/null && exit 1 | |
15 | [ "$PWD" = "$P" ] | |
16 | [ "$(pwd)" = "$P" ] | |
17 | fi | |
18 | ||
19 | chmod 755 $T | |
20 | cd $T | |
21 | mkdir -p 1/2/3 | |
22 | ln -s 1/2 link1 | |
23 | ln -s 2/3 1/link2 | |
24 | (cd -L 1/../1 && [ "$(pwd -L)" = "$P/$T/1" ]) | |
25 | (cd -L link1 && [ "$(pwd -L)" = "$P/$T/link1" ]) | |
26 | (cd -L link1 && [ "$(pwd -P)" = "$P/$T/1/2" ]) | |
27 | (cd -P link1 && [ "$(pwd -L)" = "$P/$T/1/2" ]) | |
28 | (cd -P link1 && [ "$(pwd -P)" = "$P/$T/1/2" ]) | |
29 | ||
30 | rm -rf ${P}/${T} |