4 desc="chown returns EPERM if the operation would change the ownership, but the effective user ID is not the super-user and the process is not an owner of the file"
16 expect 0 mkdir ${n0} 0755
19 expect 0 mkdir ${n1} 0755
20 expect 0 chown ${n1} 65534 65534
21 for type in regular dir fifo block char socket symlink; do
22 if [ "${type}" != "symlink" ]; then
23 create_file ${type} ${n1}/${n2} 65534 65534
24 expect EPERM -u 65534 -g 65534 chown ${n1}/${n2} 65533 65533
25 expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65534 65534
26 expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65533 65533
27 expect EPERM -u 65534 -g 65534 -- chown ${n1}/${n2} -1 65533
28 expect 0 -u 65534 -g 65534 symlink ${n2} ${n1}/${n3}
29 expect EPERM -u 65534 -g 65534 chown ${n1}/${n3} 65533 65533
30 expect EPERM -u 65533 -g 65533 chown ${n1}/${n3} 65534 65534
31 expect EPERM -u 65533 -g 65533 chown ${n1}/${n3} 65533 65533
32 expect EPERM -u 65534 -g 65534 -- chown ${n1}/${n3} -1 65533
33 expect 0 unlink ${n1}/${n3}
34 if [ "${type}" = "dir" ]; then
35 expect 0 rmdir ${n1}/${n2}
37 expect 0 unlink ${n1}/${n2}
40 create_file ${type} ${n1}/${n2} 65534 65534
41 expect EPERM -u 65534 -g 65534 lchown ${n1}/${n2} 65533 65533
42 expect EPERM -u 65533 -g 65533 lchown ${n1}/${n2} 65534 65534
43 expect EPERM -u 65533 -g 65533 lchown ${n1}/${n2} 65533 65533
44 expect EPERM -u 65534 -g 65534 -- lchown ${n1}/${n2} -1 65533
45 if [ "${type}" = "dir" ]; then
46 expect 0 rmdir ${n1}/${n2}
48 expect 0 unlink ${n1}/${n2}