turns printfs back on
[freebsd-src/fkvm-freebsd.git] / tools / regression / fstest / tests / rename / 07.t
blob40d04763a3707944682d5c6199504f431bc2f198
1 #!/bin/sh
2 # $FreeBSD$
4 desc="rename returns EPERM if the parent directory of the file pointed at by the 'from' argument has its immutable or append-only flag set"
6 dir=`dirname $0`
7 . ${dir}/../misc.sh
9 require chflags
11 echo "1..106"
13 n0=`namegen`
14 n1=`namegen`
15 n2=`namegen`
17 expect 0 mkdir ${n0} 0755
19 expect 0 create ${n0}/${n1} 0644
20 for flag in SF_IMMUTABLE UF_IMMUTABLE SF_APPEND UF_APPEND; do
21 expect 0 chflags ${n0} ${flag}
22 expect ${flag} stat ${n0} flags
23 expect EPERM rename ${n0}/${n1} ${n2}
24 done
25 expect 0 chflags ${n0} none
26 expect 0 unlink ${n0}/${n1}
28 expect 0 mkdir ${n0}/${n1} 0755
29 for flag in SF_IMMUTABLE UF_IMMUTABLE SF_APPEND UF_APPEND; do
30 expect 0 chflags ${n0} ${flag}
31 expect ${flag} stat ${n0} flags
32 expect EPERM rename ${n0}/${n1} ${n2}
33 done
34 expect 0 chflags ${n0} none
35 expect 0 rmdir ${n0}/${n1}
37 expect 0 mkfifo ${n0}/${n1} 0644
38 for flag in SF_IMMUTABLE UF_IMMUTABLE SF_APPEND UF_APPEND; do
39 expect 0 chflags ${n0} ${flag}
40 expect ${flag} stat ${n0} flags
41 expect EPERM rename ${n0}/${n1} ${n2}
42 done
43 expect 0 chflags ${n0} none
44 expect 0 unlink ${n0}/${n1}
46 expect 0 symlink ${n2} ${n0}/${n1}
47 for flag in SF_IMMUTABLE UF_IMMUTABLE SF_APPEND UF_APPEND; do
48 expect 0 chflags ${n0} ${flag}
49 expect ${flag} stat ${n0} flags
50 expect EPERM rename ${n0}/${n1} ${n2}
51 done
52 expect 0 chflags ${n0} none
53 expect 0 unlink ${n0}/${n1}
55 expect 0 create ${n0}/${n1} 0644
56 for flag in SF_NOUNLINK UF_NOUNLINK; do
57 expect 0 chflags ${n0} ${flag}
58 expect ${flag} stat ${n0} flags
59 expect 0 rename ${n0}/${n1} ${n2}
60 expect 0 rename ${n2} ${n0}/${n1}
61 done
62 expect 0 chflags ${n0} none
63 expect 0 unlink ${n0}/${n1}
65 expect 0 mkdir ${n0}/${n1} 0755
66 for flag in SF_NOUNLINK UF_NOUNLINK; do
67 expect 0 chflags ${n0} ${flag}
68 expect ${flag} stat ${n0} flags
69 expect 0 rename ${n0}/${n1} ${n2}
70 expect 0 rename ${n2} ${n0}/${n1}
71 done
72 expect 0 chflags ${n0} none
73 expect 0 rmdir ${n0}/${n1}
75 expect 0 mkfifo ${n0}/${n1} 0644
76 for flag in SF_NOUNLINK UF_NOUNLINK; do
77 expect 0 chflags ${n0} ${flag}
78 expect ${flag} stat ${n0} flags
79 expect 0 rename ${n0}/${n1} ${n2}
80 expect 0 rename ${n2} ${n0}/${n1}
81 done
82 expect 0 chflags ${n0} none
83 expect 0 unlink ${n0}/${n1}
85 expect 0 symlink ${n2} ${n0}/${n1}
86 for flag in SF_NOUNLINK UF_NOUNLINK; do
87 expect 0 chflags ${n0} ${flag}
88 expect ${flag} stat ${n0} flags
89 expect 0 rename ${n0}/${n1} ${n2}
90 expect 0 rename ${n2} ${n0}/${n1}
91 done
92 expect 0 chflags ${n0} none
93 expect 0 unlink ${n0}/${n1}
95 expect 0 rmdir ${n0}