21.t revision 272057
1#!/bin/sh 2# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/21.t 211352 2010-08-15 21:24: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..16" 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|ENOENT" rmdir ${n2}/${n0} 34expect ENOENT rmdir ${n2}/${n0} 35expect "0|ENOENT" rmdir ${n3}/${n1} 36expect ENOENT rmdir ${n3}/${n1} 37 38# Check that write permission on containing directory (${n2}) is enough 39# to move file (${n0}) from that directory. 40expect 0 create ${n2}/${n0} 0644 41expect 0 -u 65534 -g 65534 rename ${n2}/${n0} ${n3}/${n1} 42 43expect 0 unlink ${n3}/${n1} 44expect ENOENT unlink ${n2}/${n0} 45 46expect 0 rmdir ${n3} 47expect 0 rmdir ${n2} 48