2 # $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/11.t 211352 2010-08-15 21:24:17Z pjd $
4 desc="chmod returns EFTYPE if the effective user ID is not the super-user, the mode includes the sticky bit (S_ISVTX), and path does not refer to a directory"
9 if supported lchmod; then
19 expect 0 mkdir ${n0} 0755
23 for type in regular dir fifo block char socket symlink; do
24 if [ "${type}" != "symlink" ]; then
25 create_file ${type} ${n1}
26 expect 0 chmod ${n1} 01621
27 expect 01621 stat ${n1} mode
28 expect 0 symlink ${n1} ${n2}
29 expect 0 chmod ${n2} 01700
30 expect 01700 stat ${n1} mode
32 if [ "${type}" = "dir" ]; then
39 if supported lchmod; then
40 create_file ${type} ${n1}
41 expect 0 lchmod ${n1} 01621
42 expect 01621 lstat ${n1} mode
43 if [ "${type}" = "dir" ]; then
51 expect 0 mkdir ${n1} 0755
52 expect 0 chown ${n1} 65534 65534
53 expect 0 -u 65534 -g 65534 chmod ${n1} 01755
54 expect 01755 stat ${n1} mode
55 expect 0 symlink ${n1} ${n2}
56 expect 0 chmod ${n2} 01700
57 expect 01700 stat ${n1} mode
61 for type in regular fifo block char socket symlink; do
62 if [ "${type}" != "symlink" ]; then
63 create_file ${type} ${n1} 0640 65534 65534
64 expect 0 symlink ${n1} ${n2}
67 expect EFTYPE -u 65534 -g 65534 chmod ${n1} 01644
68 expect 0640 stat ${n1} mode
69 expect EFTYPE -u 65534 -g 65534 chmod ${n2} 01644
70 expect 0640 stat ${n1} mode
73 expect 0 -u 65534 -g 65534 chmod ${n1} 01644
74 expect 0644 stat ${n1} mode
75 expect 0 -u 65534 -g 65534 chmod ${n2} 01640
76 expect 0640 stat ${n1} mode
79 expect 0 -u 65534 -g 65534 chmod ${n1} 01644
80 expect 01644 stat ${n1} mode
81 expect 0 -u 65534 -g 65534 chmod ${n2} 01640
82 expect 01640 stat ${n1} mode
86 if [ "${type}" = "dir" ]; then
93 if supported lchmod; then
94 create_file ${type} ${n1} 0640 65534 65534
97 expect EFTYPE -u 65534 -g 65534 lchmod ${n1} 01644
98 expect 0640 lstat ${n1} mode
101 expect 0 -u 65534 -g 65534 lchmod ${n1} 01644
102 expect 0644 lstat ${n1} mode
105 expect 0 -u 65534 -g 65534 lchmod ${n1} 01644
106 expect 01644 lstat ${n1} mode
109 if [ "${type}" = "dir" ]; then
112 expect 0 unlink ${n1}