06.t revision 166065
1#!/bin/sh 2# $FreeBSD: head/tools/regression/fstest/tests/rename/06.t 166065 2007-01-17 01:42:12Z pjd $ 3 4desc="rename returns EPERM if the file pointed at by the 'from' argument has its immutable, undeletable or append-only flag set" 5 6dir=`dirname $0` 7. ${dir}/../misc.sh 8 9require chflags 10 11echo "1..84" 12 13n0=`namegen` 14n1=`namegen` 15 16expect 0 create ${n0} 0644 17for flag in SF_IMMUTABLE UF_IMMUTABLE SF_APPEND UF_APPEND SF_NOUNLINK UF_NOUNLINK; do 18 expect 0 chflags ${n0} ${flag} 19 expect ${flag} stat ${n0} flags 20 expect EPERM rename ${n0} ${n1} 21done 22expect 0 chflags ${n0} none 23expect 0 unlink ${n0} 24 25expect 0 mkdir ${n0} 0755 26for flag in SF_IMMUTABLE UF_IMMUTABLE SF_APPEND UF_APPEND SF_NOUNLINK UF_NOUNLINK; do 27 expect 0 chflags ${n0} ${flag} 28 expect ${flag} stat ${n0} flags 29 expect EPERM rename ${n0} ${n1} 30done 31expect 0 chflags ${n0} none 32expect 0 rmdir ${n0} 33 34expect 0 mkfifo ${n0} 0644 35for flag in SF_IMMUTABLE UF_IMMUTABLE SF_APPEND UF_APPEND SF_NOUNLINK UF_NOUNLINK; do 36 expect 0 chflags ${n0} ${flag} 37 expect ${flag} stat ${n0} flags 38 expect EPERM rename ${n0} ${n1} 39done 40expect 0 chflags ${n0} none 41expect 0 unlink ${n0} 42 43expect 0 symlink ${n1} ${n0} 44for flag in SF_IMMUTABLE UF_IMMUTABLE SF_APPEND UF_APPEND SF_NOUNLINK UF_NOUNLINK; do 45 expect 0 lchflags ${n0} ${flag} 46 expect ${flag} lstat ${n0} flags 47 expect EPERM rename ${n0} ${n1} 48done 49expect 0 lchflags ${n0} none 50expect 0 unlink ${n0} 51