2 # vim: filetype=sh noexpandtab ts=8 sw=8
3 # $FreeBSD: head/tools/regression/pjdfstest/tests/rename/21.t 211352 2010-08-15 21:24:17Z pjd $
5 desc="write access to subdirectory is required to move it to another directory"
17 expect 0 mkdir ${n2} 0777
18 expect 0 mkdir ${n3} 0777
21 # Check that write permission on containing directory (${n2}) is enough
22 # to rename subdirectory (${n0}). If we rename directory write access
23 # to this directory may also be required.
24 expect 0 mkdir ${n2}/${n0} 0700
25 expect "0|EACCES" -u 65534 -g 65534 rename ${n2}/${n0} ${n2}/${n1}
26 expect "0|EACCES" -u 65534 -g 65534 rename ${n2}/${n1} ${n2}/${n0}
28 # Check that write permission on containing directory (${n2}) is not enough
29 # to move subdirectory (${n0}) from that directory.
30 # Actually POSIX says that write access to ${n2} and ${n3} may be enough
31 # to move ${n0} from ${n2} to ${n3}.
32 expect "0|EACCES" -u 65534 -g 65534 rename ${n2}/${n0} ${n3}/${n1}
34 expect "0|ENOENT" rmdir ${n2}/${n0}
35 expect ENOENT rmdir ${n2}/${n0}
36 expect "0|ENOENT" rmdir ${n3}/${n1}
37 expect ENOENT rmdir ${n3}/${n1}
39 # Check that write permission on containing directory (${n2}) is enough
40 # to move file (${n0}) from that directory.
41 expect 0 create ${n2}/${n0} 0644
42 expect 0 -u 65534 -g 65534 rename ${n2}/${n0} ${n3}/${n1}
44 expect 0 unlink ${n3}/${n1}
45 expect ENOENT unlink ${n2}/${n0}