]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - tools/regression/pjdfstest/tests/rmdir/10.t
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / tools / regression / pjdfstest / tests / rmdir / 10.t
1 #!/bin/sh
2 # $FreeBSD$
3
4 desc="rmdir returns EPERM if the parent directory of the named file has its immutable 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..16"
14         ;;
15 FreeBSD:UFS)
16         echo "1..30"
17         ;;
18 *)
19         quick_exit
20 esac
21
22 n0=`namegen`
23 n1=`namegen`
24
25 expect 0 mkdir ${n0} 0755
26
27 expect 0 mkdir ${n0}/${n1} 0755
28 expect 0 chflags ${n0} SF_IMMUTABLE
29 expect EPERM rmdir ${n0}/${n1}
30 expect 0 chflags ${n0} none
31 expect 0 rmdir ${n0}/${n1}
32
33 expect 0 mkdir ${n0}/${n1} 0755
34 expect 0 chflags ${n0} SF_NOUNLINK
35 expect 0 rmdir ${n0}/${n1}
36 expect 0 chflags ${n0} none
37
38 expect 0 mkdir ${n0}/${n1} 0755
39 expect 0 chflags ${n0} SF_APPEND
40 todo FreeBSD:ZFS "Removing an entry from directory protected by SF_APPEND should return EPERM."
41 expect EPERM rmdir ${n0}/${n1}
42 expect 0 chflags ${n0} none
43 todo FreeBSD:ZFS "Removing an entry from directory protected by SF_APPEND should return EPERM."
44 expect 0 rmdir ${n0}/${n1}
45
46 case "${os}:${fs}" in
47 FreeBSD:UFS)
48         expect 0 mkdir ${n0}/${n1} 0755
49         expect 0 chflags ${n0} UF_IMMUTABLE
50         expect EPERM rmdir ${n0}/${n1}
51         expect 0 chflags ${n0} none
52         expect 0 rmdir ${n0}/${n1}
53
54         expect 0 mkdir ${n0}/${n1} 0755
55         expect 0 chflags ${n0} UF_NOUNLINK
56         expect 0 rmdir ${n0}/${n1}
57         expect 0 chflags ${n0} none
58
59         expect 0 mkdir ${n0}/${n1} 0755
60         expect 0 chflags ${n0} UF_APPEND
61         expect EPERM rmdir ${n0}/${n1}
62         expect 0 chflags ${n0} none
63         expect 0 rmdir ${n0}/${n1}
64         ;;
65 esac
66
67 expect 0 rmdir ${n0}