blob: 68c1037a0053ea73b5e0b44c7c846321e1f569a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#!/bin/sh
#
# $OpenBSD: test_ln.sh,v 1.1 2013/03/12 06:00:05 guenther Exp $
set -f
get_dev_ino()
{
stat -f %d:%i "$@"
}
compare_dirents()
{
opt=
if [ $# -eq 3 ]
then
opt=$1
shift
fi
echo Comparing $1 and $2
if [ `get_dev_ino $opt $1` != `get_dev_ino $opt $2` ]
then
echo comparison failed: $1 different than $2
exit 1
fi
}
test_ln()
{
[ -e $2 ] || ln $1 $2
compare_dirents $1 $2
}
test_ln_s()
{
[ -h $2 ] || ln -s $1 $2
compare_dirents -L $3 $2
}
test_ln_L()
{
[ -e $2 ] || ln -L $1 $2
# Need 3rd argument because $2 follows symlink $1
compare_dirents $2 $3
}
test_ln_P()
{
[ -e $2 ] || ln -P $1 $2
compare_dirents $1 $2
}
test_ln ./links/source ./links/hardlink1
test_ln_s source ./links/symlink1 ./links/source
test_ln_L ./links/symlink1 ./links/hardlink2 ./links/source
test_ln_P ./links/symlink1 ./links/symlink2
test_ln_s symlink1 ./links/symlink3 ./links/symlink1
test_ln_L ./links/symlink3 ./links/hardlink3 ./links/source
err=`LC_ALL=C ln -P ./links/symlink1 ./links/symlink2 2>&1`
if [ $? -eq 0 ]; then
exit 1
fi
case $err in
*"are identical"*"nothing done"*) ;;
*) exit 1;;
esac
|