.
[platform/upstream/coreutils.git] / tests / cp / no-deref-link1
1 #!/bin/sh
2 # FIXME: This test requires ln -s.
3 # cp from 3.16 fails this test
4
5 : ${CP=cp}
6
7 if test "$VERBOSE" = yes; then
8   set -x
9   $CP --version
10 fi
11
12 rm -rf a b
13 mkdir a b
14 msg=bar
15 echo $msg > a/foo
16 cd b
17 ln -s ../a/foo .
18 cd ..
19
20 fail=0
21
22 # It should fail with a message something like this:
23 #   ./cp: `a/foo' and `b/foo' are the same file
24 $CP -d a/foo b 2>/dev/null
25
26 # Fail this test if the exit status is not 1
27 test $? = 1 || fail=1
28
29 test "`cat a/foo`" = $msg || fail=1
30
31 rm -rf a b
32
33 exit $fail