4 desc="chmod returns EPERM if the operation would change the ownership, but the effective user ID is not the super-user"
9 if supported lchmod; then
20 expect 0 mkdir ${n0} 0755
23 expect 0 mkdir ${n1} 0755
24 expect 0 chown ${n1} 65534 65534
26 expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644
27 expect 0 -u 65534 -g 65534 chmod ${n1}/${n2} 0642
28 expect 0642 stat ${n1}/${n2} mode
29 expect EPERM -u 65533 -g 65533 chmod ${n1}/${n2} 0641
30 expect 0642 stat ${n1}/${n2} mode
31 expect 0 chown ${n1}/${n2} 0 0
32 expect EPERM -u 65534 -g 65534 chmod ${n1}/${n2} 0641
33 expect 0642 stat ${n1}/${n2} mode
34 expect 0 unlink ${n1}/${n2}
36 expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644
37 expect 0 -u 65534 -g 65534 symlink ${n2} ${n1}/${n3}
38 expect 0 -u 65534 -g 65534 chmod ${n1}/${n3} 0642
39 expect 0642,65534,65534 stat ${n1}/${n2} mode,uid,gid
40 expect EPERM -u 65533 -g 65533 chmod ${n1}/${n3} 0641
41 expect 0642,65534,65534 stat ${n1}/${n2} mode,uid,gid
42 expect 0 chown ${n1}/${n3} 0 0
43 expect EPERM -u 65534 -g 65534 chmod ${n1}/${n3} 0641
44 expect 0642,0,0 stat ${n1}/${n2} mode,uid,gid
45 expect 0 unlink ${n1}/${n2}
46 expect 0 unlink ${n1}/${n3}
48 if supported lchmod; then
49 expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644
50 expect 0 -u 65534 -g 65534 lchmod ${n1}/${n2} 0642
51 expect 0642 stat ${n1}/${n2} mode
52 expect EPERM -u 65533 -g 65533 lchmod ${n1}/${n2} 0641
53 expect 0642 stat ${n1}/${n2} mode
54 expect 0 chown ${n1}/${n2} 0 0
55 expect EPERM -u 65534 -g 65534 lchmod ${n1}/${n2} 0641
56 expect 0642 stat ${n1}/${n2} mode
57 expect 0 unlink ${n1}/${n2}