1#!/bin/sh 2# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/08.t 211352 2010-08-15 21:24:17Z pjd $ 3 4desc="chown returns EPERM if the named file has its immutable or append-only flag set" 5 6dir=`dirname $0` 7. ${dir}/../misc.sh 8 9require chflags 10 11case "${os}:${fs}" in 12FreeBSD:ZFS) 13 echo "1..20" 14 ;; 15FreeBSD:UFS) 16 echo "1..44" 17 ;; 18*) 19 quick_exit 20esac 21 22n0=`namegen` 23 24expect 0 create ${n0} 0644 25expect 0 chflags ${n0} SF_IMMUTABLE 26expect EPERM chown ${n0} 65534 65534 27expect 0,0 stat ${n0} uid,gid 28expect 0 chflags ${n0} none 29expect 0 chown ${n0} 65534 65534 30expect 65534,65534 stat ${n0} uid,gid 31expect 0 unlink ${n0} 32 33expect 0 create ${n0} 0644 34expect 0 chflags ${n0} SF_NOUNLINK 35expect 0 chown ${n0} 65534 65534 36expect 65534,65534 stat ${n0} uid,gid 37expect 0 chflags ${n0} none 38expect 0 unlink ${n0} 39 40case "${os}:${fs}" in 41FreeBSD:ZFS) 42 expect 0 create ${n0} 0644 43 expect 0 chflags ${n0} SF_APPEND 44 expect 0 chown ${n0} 65534 65534 45 expect 65534,65534 stat ${n0} uid,gid 46 expect 0 chflags ${n0} none 47 expect 0 unlink ${n0} 48 ;; 49FreeBSD:UFS) 50 expect 0 create ${n0} 0644 51 expect 0 chflags ${n0} SF_APPEND 52 expect EPERM chown ${n0} 65534 65534 53 expect 0,0 stat ${n0} uid,gid 54 expect 0 chflags ${n0} none 55 expect 0 chown ${n0} 65534 65534 56 expect 65534,65534 stat ${n0} uid,gid 57 expect 0 unlink ${n0} 58 59 expect 0 create ${n0} 0644 60 expect 0 chflags ${n0} UF_IMMUTABLE 61 expect EPERM chown ${n0} 65534 65534 62 expect 0,0 stat ${n0} uid,gid 63 expect 0 chflags ${n0} none 64 expect 0 chown ${n0} 65534 65534 65 expect 65534,65534 stat ${n0} uid,gid 66 expect 0 unlink ${n0} 67 68 expect 0 create ${n0} 0644 69 expect 0 chflags ${n0} UF_NOUNLINK 70 expect 0 chown ${n0} 65534 65534 71 expect 65534,65534 stat ${n0} uid,gid 72 expect 0 chflags ${n0} none 73 expect 0 unlink ${n0} 74 75 expect 0 create ${n0} 0644 76 expect 0 chflags ${n0} UF_APPEND 77 expect EPERM chown ${n0} 65534 65534 78 expect 0,0 stat ${n0} uid,gid 79 expect 0 chflags ${n0} none 80 expect 0 chown ${n0} 65534 65534 81 expect 65534,65534 stat ${n0} uid,gid 82 expect 0 unlink ${n0} 83 ;; 84esac 85