08.t revision 210984
1166065Spjd#!/bin/sh 2166065Spjd# $FreeBSD: head/tools/regression/fstest/tests/chown/08.t 210984 2010-08-06 23:58:54Z pjd $ 3166065Spjd 4166065Spjddesc="chown returns EPERM if the named file has its immutable or append-only flag set" 5166065Spjd 6166065Spjddir=`dirname $0` 7166065Spjd. ${dir}/../misc.sh 8166065Spjd 9166065Spjdrequire chflags 10166065Spjd 11210984Spjdcase "${os}:${fs}" in 12210984SpjdFreeBSD:ZFS) 13210984Spjd echo "1..20" 14210984Spjd ;; 15210984SpjdFreeBSD:UFS) 16210984Spjd echo "1..44" 17210984Spjd ;; 18210984Spjd*) 19210984Spjd quick_exit 20210984Spjdesac 21166065Spjd 22166065Spjdn0=`namegen` 23166065Spjd 24166065Spjdexpect 0 create ${n0} 0644 25166065Spjdexpect 0 chflags ${n0} SF_IMMUTABLE 26166065Spjdexpect EPERM chown ${n0} 65534 65534 27210984Spjdexpect 0,0 stat ${n0} uid,gid 28166065Spjdexpect 0 chflags ${n0} none 29166065Spjdexpect 0 chown ${n0} 65534 65534 30210984Spjdexpect 65534,65534 stat ${n0} uid,gid 31166065Spjdexpect 0 unlink ${n0} 32166065Spjd 33166065Spjdexpect 0 create ${n0} 0644 34210984Spjdexpect 0 chflags ${n0} SF_NOUNLINK 35166065Spjdexpect 0 chown ${n0} 65534 65534 36210984Spjdexpect 65534,65534 stat ${n0} uid,gid 37166065Spjdexpect 0 chflags ${n0} none 38166065Spjdexpect 0 unlink ${n0} 39166065Spjd 40210984Spjdcase "${os}:${fs}" in 41210984SpjdFreeBSD:ZFS) 42210984Spjd expect 0 create ${n0} 0644 43210984Spjd expect 0 chflags ${n0} SF_APPEND 44210984Spjd expect 0 chown ${n0} 65534 65534 45210984Spjd expect 65534,65534 stat ${n0} uid,gid 46210984Spjd expect 0 chflags ${n0} none 47210984Spjd expect 0 unlink ${n0} 48210984Spjd ;; 49210984SpjdFreeBSD:UFS) 50210984Spjd expect 0 create ${n0} 0644 51210984Spjd expect 0 chflags ${n0} SF_APPEND 52210984Spjd expect EPERM chown ${n0} 65534 65534 53210984Spjd expect 0,0 stat ${n0} uid,gid 54210984Spjd expect 0 chflags ${n0} none 55210984Spjd expect 0 chown ${n0} 65534 65534 56210984Spjd expect 65534,65534 stat ${n0} uid,gid 57210984Spjd expect 0 unlink ${n0} 58166065Spjd 59210984Spjd expect 0 create ${n0} 0644 60210984Spjd expect 0 chflags ${n0} UF_IMMUTABLE 61210984Spjd expect EPERM chown ${n0} 65534 65534 62210984Spjd expect 0,0 stat ${n0} uid,gid 63210984Spjd expect 0 chflags ${n0} none 64210984Spjd expect 0 chown ${n0} 65534 65534 65210984Spjd expect 65534,65534 stat ${n0} uid,gid 66210984Spjd expect 0 unlink ${n0} 67166065Spjd 68210984Spjd expect 0 create ${n0} 0644 69210984Spjd expect 0 chflags ${n0} UF_NOUNLINK 70210984Spjd expect 0 chown ${n0} 65534 65534 71210984Spjd expect 65534,65534 stat ${n0} uid,gid 72210984Spjd expect 0 chflags ${n0} none 73210984Spjd expect 0 unlink ${n0} 74210984Spjd 75210984Spjd expect 0 create ${n0} 0644 76210984Spjd expect 0 chflags ${n0} UF_APPEND 77210984Spjd expect EPERM chown ${n0} 65534 65534 78210984Spjd expect 0,0 stat ${n0} uid,gid 79210984Spjd expect 0 chflags ${n0} none 80210984Spjd expect 0 chown ${n0} 65534 65534 81210984Spjd expect 65534,65534 stat ${n0} uid,gid 82210984Spjd expect 0 unlink ${n0} 83210984Spjd ;; 84210984Spjdesac 85