1#!/bin/sh
| 1#!/bin/sh
|
2# $FreeBSD: head/tools/regression/fstest/tests/unlink/09.t 166065 2007-01-17 01:42:12Z pjd $
| 2# $FreeBSD: head/tools/regression/fstest/tests/unlink/09.t 210984 2010-08-06 23:58:54Z pjd $
|
3 4desc="unlink returns EPERM if the named file has its immutable, undeletable or append-only flag set" 5 6dir=`dirname $0` 7. ${dir}/../misc.sh 8 9require chflags 10
| 3 4desc="unlink returns EPERM if the named file has its immutable, undeletable or append-only flag set" 5 6dir=`dirname $0` 7. ${dir}/../misc.sh 8 9require chflags 10
|
11echo "1..30"
| 11case "${os}:${fs}" in 12FreeBSD:ZFS) 13 echo "1..15" 14 ;; 15FreeBSD:UFS) 16 echo "1..30" 17 ;; 18*) 19 quick_exit 20esac
|
12 13n0=`namegen` 14 15expect 0 create ${n0} 0644 16expect 0 chflags ${n0} SF_IMMUTABLE 17expect EPERM unlink ${n0} 18expect 0 chflags ${n0} none 19expect 0 unlink ${n0} 20 21expect 0 create ${n0} 0644
| 21 22n0=`namegen` 23 24expect 0 create ${n0} 0644 25expect 0 chflags ${n0} SF_IMMUTABLE 26expect EPERM unlink ${n0} 27expect 0 chflags ${n0} none 28expect 0 unlink ${n0} 29 30expect 0 create ${n0} 0644
|
22expect 0 chflags ${n0} UF_IMMUTABLE 23expect EPERM unlink ${n0} 24expect 0 chflags ${n0} none 25expect 0 unlink ${n0} 26 27expect 0 create ${n0} 0644
| |
28expect 0 chflags ${n0} SF_NOUNLINK 29expect EPERM unlink ${n0} 30expect 0 chflags ${n0} none 31expect 0 unlink ${n0} 32 33expect 0 create ${n0} 0644
| 31expect 0 chflags ${n0} SF_NOUNLINK 32expect EPERM unlink ${n0} 33expect 0 chflags ${n0} none 34expect 0 unlink ${n0} 35 36expect 0 create ${n0} 0644
|
34expect 0 chflags ${n0} UF_NOUNLINK 35expect EPERM unlink ${n0} 36expect 0 chflags ${n0} none 37expect 0 unlink ${n0} 38 39expect 0 create ${n0} 0644
| |
40expect 0 chflags ${n0} SF_APPEND
| 37expect 0 chflags ${n0} SF_APPEND
|
| 38todo FreeBSD:ZFS "Removing a file protected by SF_APPEND should return EPERM."
|
41expect EPERM unlink ${n0}
| 39expect EPERM unlink ${n0}
|
| 40todo FreeBSD:ZFS "Removing a file protected by SF_APPEND should return EPERM."
|
42expect 0 chflags ${n0} none
| 41expect 0 chflags ${n0} none
|
| 42todo FreeBSD:ZFS "Removing a file protected by SF_APPEND should return EPERM."
|
43expect 0 unlink ${n0} 44
| 43expect 0 unlink ${n0} 44
|
45expect 0 create ${n0} 0644 46expect 0 chflags ${n0} UF_APPEND 47expect EPERM unlink ${n0} 48expect 0 chflags ${n0} none 49expect 0 unlink ${n0}
| 45case "${os}:${fs}" in 46FreeBSD:UFS) 47 expect 0 create ${n0} 0644 48 expect 0 chflags ${n0} UF_IMMUTABLE 49 expect EPERM unlink ${n0} 50 expect 0 chflags ${n0} none 51 expect 0 unlink ${n0} 52 53 expect 0 create ${n0} 0644 54 expect 0 chflags ${n0} UF_NOUNLINK 55 expect EPERM unlink ${n0} 56 expect 0 chflags ${n0} none 57 expect 0 unlink ${n0} 58 59 expect 0 create ${n0} 0644 60 expect 0 chflags ${n0} UF_APPEND 61 expect EPERM unlink ${n0} 62 expect 0 chflags ${n0} none 63 expect 0 unlink ${n0} 64 ;; 65esac
|
| |