4 desc
="unlink returns EACCES or EPERM if the directory containing the file is marked sticky, and neither the containing directory nor the file to be removed are owned by the effective user ID"
15 expect
0 mkdir
${n2} 0755
19 expect
0 mkdir
${n0} 0755
20 expect
0 chown
${n0} 65534 65534
21 expect
0 chmod ${n0} 01777
23 # User owns both: the sticky directory and the file to be removed.
24 expect
0 -u 65534 -g 65534 create
${n0}/${n1} 0644
25 expect
0 -u 65534 -g 65534 unlink
${n0}/${n1}
26 # User owns the file to be removed, but doesn't own the sticky directory.
27 expect
0 -u 65533 -g 65533 create
${n0}/${n1} 0644
28 expect
0 -u 65533 -g 65533 unlink
${n0}/${n1}
29 # User owns the sticky directory, but doesn't own the file to be removed.
30 expect
0 -u 65533 -g 65533 create
${n0}/${n1} 0644
31 expect
0 -u 65534 -g 65534 unlink
${n0}/${n1}
32 # User doesn't own the sticky directory nor the file to be removed.
33 expect
0 -u 65534 -g 65534 create
${n0}/${n1} 0644
34 expect
"EACCES|EPERM" -u 65533 -g 65533 unlink
${n0}/${n1}
35 expect
0 unlink
${n0}/${n1}
37 # User owns both: the sticky directory and the fifo to be removed.
38 expect
0 -u 65534 -g 65534 mkfifo ${n0}/${n1} 0644
39 expect
0 -u 65534 -g 65534 unlink
${n0}/${n1}
40 # User owns the fifo to be removed, but doesn't own the sticky directory.
41 expect
0 -u 65533 -g 65533 mkfifo ${n0}/${n1} 0644
42 expect
0 -u 65533 -g 65533 unlink
${n0}/${n1}
43 # User owns the sticky directory, but doesn't own the fifo to be removed.
44 expect
0 -u 65533 -g 65533 mkfifo ${n0}/${n1} 0644
45 expect
0 -u 65534 -g 65534 unlink
${n0}/${n1}
46 # User doesn't own the sticky directory nor the fifo to be removed.
47 expect
0 -u 65534 -g 65534 mkfifo ${n0}/${n1} 0644
48 expect
"EACCES|EPERM" -u 65533 -g 65533 unlink
${n0}/${n1}
49 expect
0 unlink
${n0}/${n1}
51 # User owns both: the sticky directory and the symlink to be removed.
52 expect
0 -u 65534 -g 65534 symlink
test ${n0}/${n1}
53 expect
0 -u 65534 -g 65534 unlink
${n0}/${n1}
54 # User owns the symlink to be removed, but doesn't own the sticky directory.
55 expect
0 -u 65533 -g 65533 symlink
test ${n0}/${n1}
56 expect
0 -u 65533 -g 65533 unlink
${n0}/${n1}
57 # User owns the sticky directory, but doesn't own the symlink to be removed.
58 expect
0 -u 65533 -g 65533 symlink
test ${n0}/${n1}
59 expect
0 -u 65534 -g 65534 unlink
${n0}/${n1}
60 # User doesn't own the sticky directory nor the symlink to be removed.
61 expect
0 -u 65534 -g 65534 symlink
test ${n0}/${n1}
62 expect
"EACCES|EPERM" -u 65533 -g 65533 unlink
${n0}/${n1}
63 expect
0 unlink
${n0}/${n1}