21.t revision 185229
1#!/bin/sh
2# $FreeBSD: head/tools/regression/fstest/tests/rename/21.t 185229 2008-11-23 20:17:17Z pjd $
3
4desc="write access to subdirectory is required to move it to another directory"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9echo "1..15"
10
11n0=`namegen`
12n1=`namegen`
13n2=`namegen`
14n3=`namegen`
15
16expect 0 mkdir ${n2} 0777
17expect 0 mkdir ${n3} 0777
18cdir=`pwd`
19
20# Check that write permission on containing directory (${n2}) is enough
21# to rename subdirectory (${n0}). If we rename directory write access
22# to this directory may also be required.
23expect 0 mkdir ${n2}/${n0} 0700
24expect "0|EACCES" -u 65534 -g 65534 rename ${n2}/${n0} ${n2}/${n1}
25expect "0|EACCES" -u 65534 -g 65534 rename ${n2}/${n1} ${n2}/${n0}
26
27# Check that write permission on containing directory (${n2}) is not enough
28# to move subdirectory (${n0}) from that directory.
29# Actually POSIX says that write access to ${n2} and ${n3} may be enough
30# to move ${n0} from ${n2} to ${n3}.
31expect "0|EACCES" -u 65534 -g 65534 rename ${n2}/${n0} ${n3}/${n1}
32
33expect 0 rmdir ${n2}/${n0}
34expect ENOENT rmdir ${n2}/${n0}
35expect ENOENT rmdir ${n3}/${n1}
36
37# Check that write permission on containing directory (${n2}) is enough
38# to move file (${n0}) from that directory.
39expect 0 create ${n2}/${n0} 0755
40todo Linux "According to POSIX, write access to ${n2}/${n0} and (if exists) ${n3}/${n1} may be required if ${n0} and (if exists) ${n1} are directories, not regular files."
41expect 0 -u 65534 -g 65534 rename ${n2}/${n0} ${n3}/${n1}
42
43todo Linux "According to POSIX, write access to ${n2}/${n0} and (if exists) ${n3}/${n1} may be required if ${n0} and (if exists) ${n1} are directories, not regular files."
44expect 0 unlink ${n3}/${n1}
45todo Linux "According to POSIX, write access to ${n2}/${n0} and (if exists) ${n3}/${n1} may be required if ${n0} and (if exists) ${n1} are directories, not regular files."
46expect ENOENT unlink ${n2}/${n0}
47
48expect 0 rmdir ${n3}
49expect 0 rmdir ${n2}
50
51