768436628ebd12e03cef9b4ebd5824d24b3686df
[platform/upstream/coreutils.git] / tests / mv / partition-perm
1 #!/bin/sh
2 # Make sure permissions are preserved when moving from one partition to another.
3
4 if test "$VERBOSE" = yes; then
5   set -x
6   mv --version
7 fi
8
9 . $srcdir/setup
10 . $srcdir/../envvar-check
11 . $srcdir/../lang-default
12
13 if test -z "$other_partition_tmpdir"; then
14   exit 77
15 fi
16
17 pwd=`pwd`
18 dir=p-perm-$$
19 trap "cd $pwd; rm -rf $dir $other_partition_tmpdir" 0 1 2 3 15
20
21 mkdir $dir
22
23 cd $dir
24 : > file
25 chmod a=rwx file
26
27 umask 077
28 mv file $other_partition_tmpdir
29
30 fail=0
31 test -f file && fail=1
32 test -f $other_partition_tmpdir/file || fail=1
33
34 # This would have failed with the mv from fileutils-4.0i.
35 set _ `ls -l $other_partition_tmpdir/file`; shift; mode=$1
36 test "$mode" = "-rwxrwxrwx" || fail=1
37
38 exit $fail