4 desc
="unlink removes regular files, symbolic links, fifos and sockets"
15 expect
0 mkdir
${n2} 0755
19 expect
0 create
${n0} 0644
20 expect regular lstat
${n0} type
22 expect ENOENT lstat
${n0} type
24 expect
0 symlink
${n1} ${n0}
25 expect symlink lstat
${n0} type
27 expect ENOENT lstat
${n0} type
29 expect
0 mkfifo ${n0} 0644
30 expect fifo lstat
${n0} type
32 expect ENOENT lstat
${n0} type
34 # TODO: sockets removal
36 # successful unlink(2) updates ctime.
37 expect
0 create
${n0} 0644
38 expect
0 link
${n0} ${n1}
39 ctime1
=`${fstest} stat ${n0} ctime`
42 ctime2
=`${fstest} stat ${n0} ctime`
43 test_check
$ctime1 -lt $ctime2
46 expect
0 mkfifo ${n0} 0644
47 expect
0 link
${n0} ${n1}
48 ctime1
=`${fstest} stat ${n0} ctime`
51 ctime2
=`${fstest} stat ${n0} ctime`
52 test_check
$ctime1 -lt $ctime2
55 # unsuccessful unlink(2) does not update ctime.
56 expect
0 create
${n0} 0644
57 ctime1
=`${fstest} stat ${n0} ctime`
59 expect EACCES
-u 65534 unlink
${n0}
60 ctime2
=`${fstest} stat ${n0} ctime`
61 test_check
$ctime1 -eq $ctime2
64 expect
0 mkfifo ${n0} 0644
65 ctime1
=`${fstest} stat ${n0} ctime`
67 expect EACCES
-u 65534 unlink
${n0}
68 ctime2
=`${fstest} stat ${n0} ctime`
69 test_check
$ctime1 -eq $ctime2
72 expect
0 mkdir
${n0} 0755
73 expect
0 create
${n0}/${n1} 0644
74 time=`${fstest} stat ${n0} ctime`
76 expect
0 unlink
${n0}/${n1}
77 mtime
=`${fstest} stat ${n0} mtime`
78 test_check
$time -lt $mtime
79 ctime
=`${fstest} stat ${n0} ctime`
80 test_check
$time -lt $ctime
83 expect
0 mkdir
${n0} 0755
84 expect
0 mkfifo ${n0}/${n1} 0644
85 time=`${fstest} stat ${n0} ctime`
87 expect
0 unlink
${n0}/${n1}
88 mtime
=`${fstest} stat ${n0} mtime`
89 test_check
$time -lt $mtime
90 ctime
=`${fstest} stat ${n0} ctime`
91 test_check
$time -lt $ctime
94 expect
0 mkdir
${n0} 0755
95 expect
0 symlink
test ${n0}/${n1}
96 time=`${fstest} stat ${n0} ctime`
98 expect
0 unlink
${n0}/${n1}
99 mtime
=`${fstest} stat ${n0} mtime`
100 test_check
$time -lt $mtime
101 ctime
=`${fstest} stat ${n0} ctime`
102 test_check
$time -lt $ctime
105 expect
0 create
${n0} 0644
106 expect
0 link
${n0} ${n1}
107 time=`${fstest} stat ${n0} ctime`
109 expect
0 unlink
${n1}
110 ctime
=`${fstest} stat ${n0} ctime`
111 test_check
$time -lt $ctime
112 expect
0 unlink
${n0}