]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - tools/regression/pjdfstest/tests/unlink/09.t
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / tools / regression / pjdfstest / tests / unlink / 09.t
1 #!/bin/sh
2 # $FreeBSD$
3
4 desc="unlink returns EPERM if the named file has its immutable, undeletable or append-only flag set"
5
6 dir=`dirname $0`
7 . ${dir}/../misc.sh
8
9 require chflags
10
11 case "${os}:${fs}" in
12 FreeBSD:ZFS)
13         echo "1..15"
14         ;;
15 FreeBSD:UFS)
16         echo "1..30"
17         ;;
18 *)
19         quick_exit
20 esac
21
22 n0=`namegen`
23
24 expect 0 create ${n0} 0644
25 expect 0 chflags ${n0} SF_IMMUTABLE
26 expect EPERM unlink ${n0}
27 expect 0 chflags ${n0} none
28 expect 0 unlink ${n0}
29
30 expect 0 create ${n0} 0644
31 expect 0 chflags ${n0} SF_NOUNLINK
32 expect EPERM unlink ${n0}
33 expect 0 chflags ${n0} none
34 expect 0 unlink ${n0}
35
36 expect 0 create ${n0} 0644
37 expect 0 chflags ${n0} SF_APPEND
38 todo FreeBSD:ZFS "Removing a file protected by SF_APPEND should return EPERM."
39 expect EPERM unlink ${n0}
40 todo FreeBSD:ZFS "Removing a file protected by SF_APPEND should return EPERM."
41 expect 0 chflags ${n0} none
42 todo FreeBSD:ZFS "Removing a file protected by SF_APPEND should return EPERM."
43 expect 0 unlink ${n0}
44
45 case "${os}:${fs}" in
46 FreeBSD: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         ;;
65 esac