OpenCoverage

remove.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/coreutils/src/src/remove.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3enum Ternary-
4 {-
5 T_UNKNOWN = 2,-
6 T_NO,-
7 T_YES-
8 };-
9typedef enum Ternary Ternary;-
10-
11-
12-
13-
14enum Prompt_action-
15 {-
16 PA_DESCEND_INTO_DIR = 2,-
17 PA_REMOVE_DIR-
18 };-
19static int-
20cache_fstatat (int fd, char const *file, struct stat *st, int flag)-
21{-
22 if (st->st_size == -1
st->st_size == -1Description
TRUEevaluated 143 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 44 times by 1 test
Evaluated by:
  • rm
&& fstatat (fd, file, st, flag) != 0
fstatat (fd, f...st, flag) != 0Description
TRUEnever evaluated
FALSEevaluated 143 times by 1 test
Evaluated by:
  • rm
)
0-143
23 {-
24 st->st_size = -2;-
25 st->st_ino = -
26 (*__errno_location ())-
27 ;-
28 }
never executed: end of block
0
29 if (0 <= st->st_size
0 <= st->st_sizeDescription
TRUEevaluated 187 times by 1 test
Evaluated by:
  • rm
FALSEnever evaluated
)
0-187
30 return
executed 187 times by 1 test: return 0;
Executed by:
  • rm
0;
executed 187 times by 1 test: return 0;
Executed by:
  • rm
187
31 -
32 (*__errno_location ()) -
33 = (int) st->st_ino;-
34 return
never executed: return -1;
-1;
never executed: return -1;
0
35}-
36-
37-
38static inline struct stat *-
39cache_stat_init (struct stat *st)-
40{-
41 st->st_size = -1;-
42 return
executed 322552 times by 2 tests: return st;
Executed by:
  • mv
  • rm
st;
executed 322552 times by 2 tests: return st;
Executed by:
  • mv
  • rm
322552
43}-
44-
45-
46-
47-
48-
49static int-
50write_protected_non_symlink (int fd_cwd,-
51 char const *file,-
52 struct stat *buf)-
53{-
54 if (can_write_any_file ()
can_write_any_file ()Description
TRUEnever evaluated
FALSEevaluated 143 times by 1 test
Evaluated by:
  • rm
)
0-143
55 return
never executed: return 0;
0;
never executed: return 0;
0
56 if (cache_fstatat (fd_cwd, file, buf,
cache_fstatat ..., 0x100 ) != 0Description
TRUEnever evaluated
FALSEevaluated 143 times by 1 test
Evaluated by:
  • rm
0-143
57 0x100
cache_fstatat ..., 0x100 ) != 0Description
TRUEnever evaluated
FALSEevaluated 143 times by 1 test
Evaluated by:
  • rm
0-143
58 ) != 0
cache_fstatat ..., 0x100 ) != 0Description
TRUEnever evaluated
FALSEevaluated 143 times by 1 test
Evaluated by:
  • rm
)
0-143
59 return
never executed: return -1;
-1;
never executed: return -1;
0
60 if (-
61 ((((
(((( buf->st_m... == (0120000))Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 139 times by 1 test
Evaluated by:
  • rm
4-139
62 buf->st_mode
(((( buf->st_m... == (0120000))Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 139 times by 1 test
Evaluated by:
  • rm
4-139
63 )) & 0170000) == (0120000))
(((( buf->st_m... == (0120000))Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 139 times by 1 test
Evaluated by:
  • rm
4-139
64 )-
65 return
executed 4 times by 1 test: return 0;
Executed by:
  • rm
0;
executed 4 times by 1 test: return 0;
Executed by:
  • rm
4
66 {-
67 if (faccessat (fd_cwd, file,
faccessat (fd_..., 0x200 ) == 0Description
TRUEevaluated 133 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 6 times by 1 test
Evaluated by:
  • rm
6-133
68 2
faccessat (fd_..., 0x200 ) == 0Description
TRUEevaluated 133 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 6 times by 1 test
Evaluated by:
  • rm
6-133
69 ,
faccessat (fd_..., 0x200 ) == 0Description
TRUEevaluated 133 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 6 times by 1 test
Evaluated by:
  • rm
6-133
70 0x200
faccessat (fd_..., 0x200 ) == 0Description
TRUEevaluated 133 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 6 times by 1 test
Evaluated by:
  • rm
6-133
71 ) == 0
faccessat (fd_..., 0x200 ) == 0Description
TRUEevaluated 133 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 6 times by 1 test
Evaluated by:
  • rm
)
6-133
72 return
executed 133 times by 1 test: return 0;
Executed by:
  • rm
0;
executed 133 times by 1 test: return 0;
Executed by:
  • rm
133
73-
74 return
executed 6 times by 1 test: return (*__errno_location ()) == 13 ? 1 : -1;
Executed by:
  • rm
executed 6 times by 1 test: return (*__errno_location ()) == 13 ? 1 : -1;
Executed by:
  • rm
6
75 (*__errno_location ())
executed 6 times by 1 test: return (*__errno_location ()) == 13 ? 1 : -1;
Executed by:
  • rm
6
76 ==
executed 6 times by 1 test: return (*__errno_location ()) == 13 ? 1 : -1;
Executed by:
  • rm
6
77 13
executed 6 times by 1 test: return (*__errno_location ()) == 13 ? 1 : -1;
Executed by:
  • rm
6
78 ? 1 : -1;
executed 6 times by 1 test: return (*__errno_location ()) == 13 ? 1 : -1;
Executed by:
  • rm
6
79 }-
80}-
81static enum RM_status-
82prompt (FTS const *fts, FTSENT const *ent, -
83 _Bool -
84 is_dir,-
85 struct rm_options const *x, enum Prompt_action mode,-
86 Ternary *is_empty_p)-
87{-
88 int fd_cwd = fts->fts_cwd_fd;-
89 char const *full_name = ent->fts_path;-
90 char const *filename = ent->fts_accpath;-
91 if (is_empty_p
is_empty_pDescription
TRUEevaluated 56489 times by 2 tests
Evaluated by:
  • mv
  • rm
FALSEevaluated 266063 times by 2 tests
Evaluated by:
  • mv
  • rm
)
56489-266063
92 *
executed 56489 times by 2 tests: *is_empty_p = T_UNKNOWN;
Executed by:
  • mv
  • rm
is_empty_p = T_UNKNOWN;
executed 56489 times by 2 tests: *is_empty_p = T_UNKNOWN;
Executed by:
  • mv
  • rm
56489
93-
94 struct stat st;-
95 struct stat *sbuf = &st;-
96 cache_stat_init (sbuf);-
97-
98 int dirent_type = is_dir
is_dirDescription
TRUEevaluated 72734 times by 2 tests
Evaluated by:
  • mv
  • rm
FALSEevaluated 249818 times by 2 tests
Evaluated by:
  • mv
  • rm
?
72734-249818
99 DT_DIR -
100 : -
101 DT_UNKNOWN-
102 ;-
103 int write_protected = 0;-
104-
105 -
106 _Bool -
107 is_empty = -
108 0-
109 ;-
110 if (is_empty_p
is_empty_pDescription
TRUEevaluated 56489 times by 2 tests
Evaluated by:
  • mv
  • rm
FALSEevaluated 266063 times by 2 tests
Evaluated by:
  • mv
  • rm
)
56489-266063
111 {-
112 is_empty = is_empty_dir (fd_cwd, filename);-
113 *is_empty_p = is_empty
is_emptyDescription
TRUEevaluated 40242 times by 2 tests
Evaluated by:
  • mv
  • rm
FALSEevaluated 16247 times by 2 tests
Evaluated by:
  • mv
  • rm
? T_YES : T_NO;
16247-40242
114 }
executed 56489 times by 2 tests: end of block
Executed by:
  • mv
  • rm
56489
115-
116-
117-
118-
119 if (ent->fts_number
ent->fts_numberDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 322543 times by 2 tests
Evaluated by:
  • mv
  • rm
)
9-322543
120 return
executed 9 times by 1 test: return RM_USER_DECLINED;
Executed by:
  • rm
RM_USER_DECLINED;
executed 9 times by 1 test: return RM_USER_DECLINED;
Executed by:
  • rm
9
121-
122 if (x->interactive == RMI_NEVER
x->interactive == RMI_NEVERDescription
TRUEevaluated 298049 times by 2 tests
Evaluated by:
  • mv
  • rm
FALSEevaluated 24494 times by 1 test
Evaluated by:
  • rm
)
24494-298049
123 return
executed 298049 times by 2 tests: return RM_OK;
Executed by:
  • mv
  • rm
RM_OK;
executed 298049 times by 2 tests: return RM_OK;
Executed by:
  • mv
  • rm
298049
124-
125 int wp_errno = 0;-
126 if (!x->ignore_missing_files
!x->ignore_missing_filesDescription
TRUEevaluated 24494 times by 1 test
Evaluated by:
  • rm
FALSEnever evaluated
0-24494
127 && ((
(x->interactive == RMI_ALWAYS)Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 24464 times by 1 test
Evaluated by:
  • rm
x->interactive == RMI_ALWAYS)
(x->interactive == RMI_ALWAYS)Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 24464 times by 1 test
Evaluated by:
  • rm
|| x->stdin_tty
x->stdin_ttyDescription
TRUEevaluated 113 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 24351 times by 1 test
Evaluated by:
  • rm
)
30-24464
128 && dirent_type !=
dirent_type != DT_LNKDescription
TRUEevaluated 143 times by 1 test
Evaluated by:
  • rm
FALSEnever evaluated
0-143
129 DT_LNK
dirent_type != DT_LNKDescription
TRUEevaluated 143 times by 1 test
Evaluated by:
  • rm
FALSEnever evaluated
0-143
130 )-
131 {-
132 write_protected = write_protected_non_symlink (fd_cwd, filename, sbuf);-
133 wp_errno = -
134 (*__errno_location ())-
135 ;-
136 }
executed 143 times by 1 test: end of block
Executed by:
  • rm
143
137-
138 if (write_protected
write_protectedDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 24488 times by 1 test
Evaluated by:
  • rm
|| x->interactive == RMI_ALWAYS
x->interactive == RMI_ALWAYSDescription
TRUEevaluated 27 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 24461 times by 1 test
Evaluated by:
  • rm
)
6-24488
139 {-
140 if (0 <= write_protected
0 <= write_protectedDescription
TRUEevaluated 33 times by 1 test
Evaluated by:
  • rm
FALSEnever evaluated
&& dirent_type ==
dirent_type == DT_UNKNOWNDescription
TRUEevaluated 17 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 16 times by 1 test
Evaluated by:
  • rm
0-33
141 DT_UNKNOWN
dirent_type == DT_UNKNOWNDescription
TRUEevaluated 17 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 16 times by 1 test
Evaluated by:
  • rm
16-17
142 )-
143 {-
144 if (cache_fstatat (fd_cwd, filename, sbuf,
cache_fstatat ..., 0x100 ) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • rm
FALSEnever evaluated
0-17
145 0x100
cache_fstatat ..., 0x100 ) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • rm
FALSEnever evaluated
0-17
146 ) == 0
cache_fstatat ..., 0x100 ) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • rm
FALSEnever evaluated
)
0-17
147 {-
148 if (-
149 ((((
(((( sbuf->st_... == (0120000))Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 15 times by 1 test
Evaluated by:
  • rm
2-15
150 sbuf->st_mode
(((( sbuf->st_... == (0120000))Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 15 times by 1 test
Evaluated by:
  • rm
2-15
151 )) & 0170000) == (0120000))
(((( sbuf->st_... == (0120000))Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 15 times by 1 test
Evaluated by:
  • rm
2-15
152 )-
153 dirent_type =
executed 2 times by 1 test: dirent_type = DT_LNK ;
Executed by:
  • rm
2
154 DT_LNK
executed 2 times by 1 test: dirent_type = DT_LNK ;
Executed by:
  • rm
2
155 ;
executed 2 times by 1 test: dirent_type = DT_LNK ;
Executed by:
  • rm
2
156 else if (-
157 ((((
(((( sbuf->st_... == (0040000))Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • rm
0-15
158 sbuf->st_mode
(((( sbuf->st_... == (0040000))Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • rm
0-15
159 )) & 0170000) == (0040000))
(((( sbuf->st_... == (0040000))Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • rm
0-15
160 )-
161 dirent_type =
never executed: dirent_type = DT_DIR ;
0
162 DT_DIR
never executed: dirent_type = DT_DIR ;
0
163 ;
never executed: dirent_type = DT_DIR ;
0
164-
165 }
executed 17 times by 1 test: end of block
Executed by:
  • rm
17
166 else-
167 {-
168-
169 write_protected = -1;-
170 wp_errno = -
171 (*__errno_location ())-
172 ;-
173 }
never executed: end of block
0
174 }-
175-
176 if (0 <= write_protected
0 <= write_protectedDescription
TRUEevaluated 33 times by 1 test
Evaluated by:
  • rm
FALSEnever evaluated
)
0-33
177 switch (dirent_type)-
178 {-
179 case
executed 2 times by 1 test: case DT_LNK :
Executed by:
  • rm
executed 2 times by 1 test: case DT_LNK :
Executed by:
  • rm
2
180 DT_LNK
executed 2 times by 1 test: case DT_LNK :
Executed by:
  • rm
2
181 :
executed 2 times by 1 test: case DT_LNK :
Executed by:
  • rm
2
182-
183 if (x->interactive != RMI_ALWAYS
x->interactive != RMI_ALWAYSDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • rm
)
0-2
184 return
never executed: return RM_OK;
RM_OK;
never executed: return RM_OK;
0
185 break;
executed 2 times by 1 test: break;
Executed by:
  • rm
2
186-
187 case
executed 16 times by 1 test: case DT_DIR :
Executed by:
  • rm
executed 16 times by 1 test: case DT_DIR :
Executed by:
  • rm
16
188 DT_DIR
executed 16 times by 1 test: case DT_DIR :
Executed by:
  • rm
16
189 :
executed 16 times by 1 test: case DT_DIR :
Executed by:
  • rm
16
190-
191-
192-
193 if ( ! (x->recursive
x->recursiveDescription
TRUEevaluated 15 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 1 time by 1 test
Evaluated by:
  • rm
|| (x->remove_empty_directories
x->remove_empty_directoriesDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • rm
FALSEnever evaluated
&& is_empty
is_emptyDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • rm
FALSEnever evaluated
)))
0-15
194 {-
195 write_protected = -1;-
196 wp_errno = -
197 21-
198 ;-
199 }
never executed: end of block
0
200 break;
executed 16 times by 1 test: break;
Executed by:
  • rm
16
201 }
never executed: end of block
0
202-
203 char const *quoted_name = quotearg_style (shell_escape_always_quoting_style, full_name);-
204-
205 if (write_protected < 0
write_protected < 0Description
TRUEnever evaluated
FALSEevaluated 33 times by 1 test
Evaluated by:
  • rm
)
0-33
206 {-
207 error (0, wp_errno, -
208 dcgettext (((void *)0), -
209 "cannot remove %s"-
210 , 5)-
211 , quoted_name);-
212 return
never executed: return RM_ERROR;
RM_ERROR;
never executed: return RM_ERROR;
0
213 }-
214-
215-
216 if (dirent_type ==
dirent_type == DT_DIRDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 17 times by 1 test
Evaluated by:
  • rm
16-17
217 DT_DIR
dirent_type == DT_DIRDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 17 times by 1 test
Evaluated by:
  • rm
16-17
218 -
219 && mode == PA_DESCEND_INTO_DIR
mode == PA_DESCEND_INTO_DIRDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 6 times by 1 test
Evaluated by:
  • rm
6-10
220 && !is_empty
!is_emptyDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 4 times by 1 test
Evaluated by:
  • rm
)
4-6
221 fprintf (
executed 6 times by 1 test: fprintf ( stderr , (write_protected ? dcgettext (((void *)0), "%s: descend into write-protected directory %s? " , 5) : dcgettext (((void *)0), "%s: descend into directory %s? " , 5) ), program_name, quoted_name);
Executed by:
  • rm
6
222 stderr
executed 6 times by 1 test: fprintf ( stderr , (write_protected ? dcgettext (((void *)0), "%s: descend into write-protected directory %s? " , 5) : dcgettext (((void *)0), "%s: descend into directory %s? " , 5) ), program_name, quoted_name);
Executed by:
  • rm
6
223 ,
executed 6 times by 1 test: fprintf ( stderr , (write_protected ? dcgettext (((void *)0), "%s: descend into write-protected directory %s? " , 5) : dcgettext (((void *)0), "%s: descend into directory %s? " , 5) ), program_name, quoted_name);
Executed by:
  • rm
6
224 (write_protected
executed 6 times by 1 test: fprintf ( stderr , (write_protected ? dcgettext (((void *)0), "%s: descend into write-protected directory %s? " , 5) : dcgettext (((void *)0), "%s: descend into directory %s? " , 5) ), program_name, quoted_name);
Executed by:
  • rm
6
225 ?
executed 6 times by 1 test: fprintf ( stderr , (write_protected ? dcgettext (((void *)0), "%s: descend into write-protected directory %s? " , 5) : dcgettext (((void *)0), "%s: descend into directory %s? " , 5) ), program_name, quoted_name);
Executed by:
  • rm
6
226 dcgettext (((void *)0),
executed 6 times by 1 test: fprintf ( stderr , (write_protected ? dcgettext (((void *)0), "%s: descend into write-protected directory %s? " , 5) : dcgettext (((void *)0), "%s: descend into directory %s? " , 5) ), program_name, quoted_name);
Executed by:
  • rm
6
227 "%s: descend into write-protected directory %s? "
executed 6 times by 1 test: fprintf ( stderr , (write_protected ? dcgettext (((void *)0), "%s: descend into write-protected directory %s? " , 5) : dcgettext (((void *)0), "%s: descend into directory %s? " , 5) ), program_name, quoted_name);
Executed by:
  • rm
6
228 , 5)
executed 6 times by 1 test: fprintf ( stderr , (write_protected ? dcgettext (((void *)0), "%s: descend into write-protected directory %s? " , 5) : dcgettext (((void *)0), "%s: descend into directory %s? " , 5) ), program_name, quoted_name);
Executed by:
  • rm
6
229
executed 6 times by 1 test: fprintf ( stderr , (write_protected ? dcgettext (((void *)0), "%s: descend into write-protected directory %s? " , 5) : dcgettext (((void *)0), "%s: descend into directory %s? " , 5) ), program_name, quoted_name);
Executed by:
  • rm
6
230 :
executed 6 times by 1 test: fprintf ( stderr , (write_protected ? dcgettext (((void *)0), "%s: descend into write-protected directory %s? " , 5) : dcgettext (((void *)0), "%s: descend into directory %s? " , 5) ), program_name, quoted_name);
Executed by:
  • rm
6
231 dcgettext (((void *)0),
executed 6 times by 1 test: fprintf ( stderr , (write_protected ? dcgettext (((void *)0), "%s: descend into write-protected directory %s? " , 5) : dcgettext (((void *)0), "%s: descend into directory %s? " , 5) ), program_name, quoted_name);
Executed by:
  • rm
6
232 "%s: descend into directory %s? "
executed 6 times by 1 test: fprintf ( stderr , (write_protected ? dcgettext (((void *)0), "%s: descend into write-protected directory %s? " , 5) : dcgettext (((void *)0), "%s: descend into directory %s? " , 5) ), program_name, quoted_name);
Executed by:
  • rm
6
233 , 5)
executed 6 times by 1 test: fprintf ( stderr , (write_protected ? dcgettext (((void *)0), "%s: descend into write-protected directory %s? " , 5) : dcgettext (((void *)0), "%s: descend into directory %s? " , 5) ), program_name, quoted_name);
Executed by:
  • rm
6
234 ),
executed 6 times by 1 test: fprintf ( stderr , (write_protected ? dcgettext (((void *)0), "%s: descend into write-protected directory %s? " , 5) : dcgettext (((void *)0), "%s: descend into directory %s? " , 5) ), program_name, quoted_name);
Executed by:
  • rm
6
235 program_name, quoted_name);
executed 6 times by 1 test: fprintf ( stderr , (write_protected ? dcgettext (((void *)0), "%s: descend into write-protected directory %s? " , 5) : dcgettext (((void *)0), "%s: descend into directory %s? " , 5) ), program_name, quoted_name);
Executed by:
  • rm
6
236 else-
237 {-
238 if (cache_fstatat (fd_cwd, filename, sbuf,
cache_fstatat ..., 0x100 ) != 0Description
TRUEnever evaluated
FALSEevaluated 27 times by 1 test
Evaluated by:
  • rm
0-27
239 0x100
cache_fstatat ..., 0x100 ) != 0Description
TRUEnever evaluated
FALSEevaluated 27 times by 1 test
Evaluated by:
  • rm
0-27
240 ) != 0
cache_fstatat ..., 0x100 ) != 0Description
TRUEnever evaluated
FALSEevaluated 27 times by 1 test
Evaluated by:
  • rm
)
0-27
241 {-
242 error (0, -
243 (*__errno_location ())-
244 , -
245 dcgettext (((void *)0), -
246 "cannot remove %s"-
247 , 5)-
248 , quoted_name);-
249 return
never executed: return RM_ERROR;
RM_ERROR;
never executed: return RM_ERROR;
0
250 }-
251-
252 fprintf (-
253 stderr-
254 ,-
255 (write_protected-
256-
257-
258-
259-
260-
261 ? -
262 dcgettext (((void *)0), -
263 "%s: remove write-protected %s %s? "-
264 , 5)-
265 -
266 : -
267 dcgettext (((void *)0), -
268 "%s: remove %s %s? "-
269 , 5)-
270 ),-
271 program_name, file_type (sbuf), quoted_name);-
272 }
executed 27 times by 1 test: end of block
Executed by:
  • rm
27
273-
274 if (!yesno ()
!yesno ()Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 24 times by 1 test
Evaluated by:
  • rm
)
9-24
275 return
executed 9 times by 1 test: return RM_USER_DECLINED;
Executed by:
  • rm
RM_USER_DECLINED;
executed 9 times by 1 test: return RM_USER_DECLINED;
Executed by:
  • rm
9
276 }
executed 24 times by 1 test: end of block
Executed by:
  • rm
24
277 return
executed 24485 times by 1 test: return RM_OK;
Executed by:
  • rm
RM_OK;
executed 24485 times by 1 test: return RM_OK;
Executed by:
  • rm
24485
278}-
279-
280-
281-
282-
283static inline -
284 _Bool-
285-
286nonexistent_file_errno (int errnum)-
287{-
288 switch (errnum)-
289 {-
290 case
never executed: case 84 :
never executed: case 84 :
0
291 84
never executed: case 84 :
0
292 :
never executed: case 84 :
0
293 case
never executed: case 22 :
never executed: case 22 :
0
294 22
never executed: case 22 :
0
295 :
never executed: case 22 :
0
296 case
executed 492 times by 1 test: case 2 :
Executed by:
  • rm
executed 492 times by 1 test: case 2 :
Executed by:
  • rm
492
297 2
executed 492 times by 1 test: case 2 :
Executed by:
  • rm
492
298 :
executed 492 times by 1 test: case 2 :
Executed by:
  • rm
492
299 case
executed 1 time by 1 test: case 20 :
Executed by:
  • rm
executed 1 time by 1 test: case 20 :
Executed by:
  • rm
1
300 20
executed 1 time by 1 test: case 20 :
Executed by:
  • rm
1
301 :
executed 1 time by 1 test: case 20 :
Executed by:
  • rm
1
302 return
executed 493 times by 1 test: return 1 ;
Executed by:
  • rm
executed 493 times by 1 test: return 1 ;
Executed by:
  • rm
493
303 1
executed 493 times by 1 test: return 1 ;
Executed by:
  • rm
493
304 ;
executed 493 times by 1 test: return 1 ;
Executed by:
  • rm
493
305 default
executed 11 times by 1 test: default:
Executed by:
  • rm
:
executed 11 times by 1 test: default:
Executed by:
  • rm
11
306 return
executed 11 times by 1 test: return 0 ;
Executed by:
  • rm
executed 11 times by 1 test: return 0 ;
Executed by:
  • rm
11
307 0
executed 11 times by 1 test: return 0 ;
Executed by:
  • rm
11
308 ;
executed 11 times by 1 test: return 0 ;
Executed by:
  • rm
11
309 }-
310}-
311-
312-
313static inline -
314 _Bool-
315-
316ignorable_missing (struct rm_options const *x, int errnum)-
317{-
318 return
executed 509 times by 1 test: return x->ignore_missing_files && nonexistent_file_errno (errnum);
Executed by:
  • rm
x->ignore_missing_files && nonexistent_file_errno (errnum);
executed 509 times by 1 test: return x->ignore_missing_files && nonexistent_file_errno (errnum);
Executed by:
  • rm
509
319}-
320-
321-
322static void-
323fts_skip_tree (FTS *fts, FTSENT *ent)-
324{-
325 fts_set (fts, ent, 4);-
326-
327 (__extension__ ({ __typeof__ (fts_read (fts)) __x = (fts_read (fts)); (void) __x; }));-
328}
executed 40254 times by 2 tests: end of block
Executed by:
  • mv
  • rm
40254
329-
330-
331-
332-
333static void-
334mark_ancestor_dirs (FTSENT *ent)-
335{-
336 FTSENT *p;-
337 for (p = ent->fts_parent; 0 <= p->fts_level
0 <= p->fts_levelDescription
TRUEevaluated 11 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 21 times by 1 test
Evaluated by:
  • rm
; p = p->fts_parent)
11-21
338 {-
339 if (p->fts_number
p->fts_numberDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • rm
FALSEevaluated 10 times by 1 test
Evaluated by:
  • rm
)
1-10
340 break;
executed 1 time by 1 test: break;
Executed by:
  • rm
1
341 p->fts_number = 1;-
342 }
executed 10 times by 1 test: end of block
Executed by:
  • rm
10
343}
executed 22 times by 1 test: end of block
Executed by:
  • rm
22
344-
345-
346-
347-
348static enum RM_status-
349excise (FTS *fts, FTSENT *ent, struct rm_options const *x, -
350 _Bool -
351 is_dir)-
352{-
353 int flag = is_dir
is_dirDescription
TRUEevaluated 56476 times by 2 tests
Evaluated by:
  • mv
  • rm
FALSEevaluated 249811 times by 2 tests
Evaluated by:
  • mv
  • rm
?
56476-249811
354 0x200 -
355 : 0;-
356 if (unlinkat (fts->fts_cwd_fd, ent->fts_accpath, flag) == 0
unlinkat (fts-...th, flag) == 0Description
TRUEevaluated 305778 times by 2 tests
Evaluated by:
  • mv
  • rm
FALSEevaluated 509 times by 1 test
Evaluated by:
  • rm
)
509-305778
357 {-
358 if (x->verbose
x->verboseDescription
TRUEevaluated 26 times by 2 tests
Evaluated by:
  • mv
  • rm
FALSEevaluated 305752 times by 2 tests
Evaluated by:
  • mv
  • rm
)
26-305752
359 {-
360 printf ((is_dir-
361 ? -
362 dcgettext (((void *)0), -
363 "removed directory %s\n"-
364 , 5)-
365 -
366 : -
367 dcgettext (((void *)0), -
368 "removed %s\n"-
369 , 5)-
370 ), quotearg_style (shell_escape_always_quoting_style, ent->fts_path));-
371 }
executed 26 times by 2 tests: end of block
Executed by:
  • mv
  • rm
26
372 return
executed 305778 times by 2 tests: return RM_OK;
Executed by:
  • mv
  • rm
RM_OK;
executed 305778 times by 2 tests: return RM_OK;
Executed by:
  • mv
  • rm
305778
373 }-
374-
375-
376-
377-
378-
379 if (-
380 (*
(*__errno_location ()) == 30Description
TRUEnever evaluated
FALSEevaluated 509 times by 1 test
Evaluated by:
  • rm
__errno_location ())
(*__errno_location ()) == 30Description
TRUEnever evaluated
FALSEevaluated 509 times by 1 test
Evaluated by:
  • rm
0-509
381 ==
(*__errno_location ()) == 30Description
TRUEnever evaluated
FALSEevaluated 509 times by 1 test
Evaluated by:
  • rm
0-509
382 30
(*__errno_location ()) == 30Description
TRUEnever evaluated
FALSEevaluated 509 times by 1 test
Evaluated by:
  • rm
0-509
383 )-
384 {-
385 struct stat st;-
386 if ( ! (lstatat (fts->fts_cwd_fd, ent->fts_accpath, &st)
lstatat (fts->..._accpath, &st)Description
TRUEnever evaluated
FALSEnever evaluated
0
387 && -
388 (*
(*__errno_location ()) == 2Description
TRUEnever evaluated
FALSEnever evaluated
__errno_location ())
(*__errno_location ()) == 2Description
TRUEnever evaluated
FALSEnever evaluated
0
389 ==
(*__errno_location ()) == 2Description
TRUEnever evaluated
FALSEnever evaluated
0
390 2
(*__errno_location ()) == 2Description
TRUEnever evaluated
FALSEnever evaluated
0
391 ))-
392 -
393 (*
never executed: (*__errno_location ()) = 30 ;
__errno_location ())
never executed: (*__errno_location ()) = 30 ;
0
394 =
never executed: (*__errno_location ()) = 30 ;
0
395 30
never executed: (*__errno_location ()) = 30 ;
0
396 ;
never executed: (*__errno_location ()) = 30 ;
0
397 }
never executed: end of block
0
398-
399 if (ignorable_missing (x,
ignorable_miss...location ()) )Description
TRUEevaluated 493 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 16 times by 1 test
Evaluated by:
  • rm
16-493
400 (*__errno_location ())
ignorable_miss...location ()) )Description
TRUEevaluated 493 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 16 times by 1 test
Evaluated by:
  • rm
16-493
401 )
ignorable_miss...location ()) )Description
TRUEevaluated 493 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 16 times by 1 test
Evaluated by:
  • rm
)
16-493
402 return
executed 493 times by 1 test: return RM_OK;
Executed by:
  • rm
RM_OK;
executed 493 times by 1 test: return RM_OK;
Executed by:
  • rm
493
403-
404-
405-
406-
407-
408-
409 if (ent->fts_info == 4
ent->fts_info == 4Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 13 times by 1 test
Evaluated by:
  • rm
3-13
410 && (-
411 (*
(*__errno_location ()) == 39Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • rm
FALSEnever evaluated
__errno_location ())
(*__errno_location ()) == 39Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • rm
FALSEnever evaluated
0-3
412 ==
(*__errno_location ()) == 39Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • rm
FALSEnever evaluated
0-3
413 39
(*__errno_location ()) == 39Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • rm
FALSEnever evaluated
0-3
414 || -
415 (*
(*__errno_location ()) == 21Description
TRUEnever evaluated
FALSEnever evaluated
__errno_location ())
(*__errno_location ()) == 21Description
TRUEnever evaluated
FALSEnever evaluated
0
416 ==
(*__errno_location ()) == 21Description
TRUEnever evaluated
FALSEnever evaluated
0
417 21
(*__errno_location ()) == 21Description
TRUEnever evaluated
FALSEnever evaluated
0
418 || -
419 (*
(*__errno_location ()) == 20Description
TRUEnever evaluated
FALSEnever evaluated
__errno_location ())
(*__errno_location ()) == 20Description
TRUEnever evaluated
FALSEnever evaluated
0
420 ==
(*__errno_location ()) == 20Description
TRUEnever evaluated
FALSEnever evaluated
0
421 20
(*__errno_location ()) == 20Description
TRUEnever evaluated
FALSEnever evaluated
0
422 -
423 || -
424 (*
(*__errno_location ()) == 17Description
TRUEnever evaluated
FALSEnever evaluated
__errno_location ())
(*__errno_location ()) == 17Description
TRUEnever evaluated
FALSEnever evaluated
0
425 ==
(*__errno_location ()) == 17Description
TRUEnever evaluated
FALSEnever evaluated
0
426 17
(*__errno_location ()) == 17Description
TRUEnever evaluated
FALSEnever evaluated
0
427 )-
428 && (ent->fts_errno ==
ent->fts_errno == 1Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • rm
0-3
429 1
ent->fts_errno == 1Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • rm
0-3
430 || ent->fts_errno ==
ent->fts_errno == 13Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 1 time by 1 test
Evaluated by:
  • rm
1-2
431 13
ent->fts_errno == 13Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 1 time by 1 test
Evaluated by:
  • rm
1-2
432 ))-
433 -
434 (*
executed 2 times by 1 test: (*__errno_location ()) = ent->fts_errno;
Executed by:
  • rm
__errno_location ())
executed 2 times by 1 test: (*__errno_location ()) = ent->fts_errno;
Executed by:
  • rm
2
435 = ent->fts_errno;
executed 2 times by 1 test: (*__errno_location ()) = ent->fts_errno;
Executed by:
  • rm
2
436 error (0, -
437 (*__errno_location ())-
438 , -
439 dcgettext (((void *)0), -
440 "cannot remove %s"-
441 , 5)-
442 , quotearg_style (shell_escape_always_quoting_style, ent->fts_path));-
443 mark_ancestor_dirs (ent);-
444 return
executed 16 times by 1 test: return RM_ERROR;
Executed by:
  • rm
RM_ERROR;
executed 16 times by 1 test: return RM_ERROR;
Executed by:
  • rm
16
445}-
446-
447-
448-
449-
450-
451-
452-
453static enum RM_status-
454rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x)-
455{-
456 switch (ent->fts_info)-
457 {-
458 case
executed 56499 times by 2 tests: case 1:
Executed by:
  • mv
  • rm
1:
executed 56499 times by 2 tests: case 1:
Executed by:
  • mv
  • rm
56499
459 if (! x->recursive
! x->recursiveDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 56492 times by 2 tests
Evaluated by:
  • mv
  • rm
7-56492
460 && !(x->remove_empty_directories
x->remove_empty_directoriesDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 4 times by 1 test
Evaluated by:
  • rm
3-4
461 && is_empty_dir (fts->fts_cwd_fd, ent->fts_accpath)
is_empty_dir (...->fts_accpath)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 1 time by 1 test
Evaluated by:
  • rm
))
1-2
462 {-
463-
464-
465-
466-
467 int err = x->remove_empty_directories
x->remove_empty_directoriesDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • rm
FALSEevaluated 4 times by 1 test
Evaluated by:
  • rm
?
1-4
468 39 -
469 : -
470 21-
471 ;-
472 error (0, err, -
473 dcgettext (((void *)0), -
474 "cannot remove %s"-
475 , 5)-
476 , quotearg_style (shell_escape_always_quoting_style, ent->fts_path));-
477 mark_ancestor_dirs (ent);-
478 fts_skip_tree (fts, ent);-
479 return
executed 5 times by 1 test: return RM_ERROR;
Executed by:
  • rm
RM_ERROR;
executed 5 times by 1 test: return RM_ERROR;
Executed by:
  • rm
5
480 }-
481-
482-
483 if (ent->fts_level == 0
ent->fts_level == 0Description
TRUEevaluated 4172 times by 2 tests
Evaluated by:
  • mv
  • rm
FALSEevaluated 52322 times by 2 tests
Evaluated by:
  • mv
  • rm
)
4172-52322
484 {-
485-
486-
487-
488 if (dot_or_dotdot (last_component (ent->fts_accpath))
dot_or_dotdot ...>fts_accpath))Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 4167 times by 2 tests
Evaluated by:
  • mv
  • rm
)
5-4167
489 {-
490 error (0, 0,-
491 -
492 dcgettext (((void *)0), -
493 "refusing to remove %s or %s directory: skipping %s"-
494 , 5)-
495 ,-
496 quotearg_n_style (0, shell_escape_always_quoting_style, "."), quotearg_n_style (1, shell_escape_always_quoting_style, ".."),-
497 quotearg_n_style (2, shell_escape_always_quoting_style, ent->fts_path));-
498 fts_skip_tree (fts, ent);-
499 return
executed 5 times by 1 test: return RM_ERROR;
Executed by:
  • rm
RM_ERROR;
executed 5 times by 1 test: return RM_ERROR;
Executed by:
  • rm
5
500 }-
501-
502-
503-
504-
505 if ((x->root_dev_ino
x->root_dev_inoDescription
TRUEevaluated 4165 times by 2 tests
Evaluated by:
  • mv
  • rm
FALSEevaluated 2 times by 1 test
Evaluated by:
  • rm
&& ((*
(*ent->fts_sta...ev_ino).st_inoDescription
TRUEnever evaluated
FALSEevaluated 4165 times by 2 tests
Evaluated by:
  • mv
  • rm
ent->fts_statp).st_ino == (*x->root_dev_ino).st_ino
(*ent->fts_sta...ev_ino).st_inoDescription
TRUEnever evaluated
FALSEevaluated 4165 times by 2 tests
Evaluated by:
  • mv
  • rm
&& (*
(*ent->fts_sta...ev_ino).st_devDescription
TRUEnever evaluated
FALSEnever evaluated
ent->fts_statp).st_dev == (*x->root_dev_ino).st_dev
(*ent->fts_sta...ev_ino).st_devDescription
TRUEnever evaluated
FALSEnever evaluated
)))
0-4165
506 {-
507 do { if ((
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
508 __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
509 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
510 ) && __builtin_constant_p (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
511 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
512 ) && (__s1_len = __builtin_strlen (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
513 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
514 ), __s2_len = __builtin_strlen (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
515 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
516 ), (!((size_t)(const void *)((
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
517 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
518 ) + 1) - (size_t)(const void *)(
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
519 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
520 ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
521 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
522 ) + 1) - (size_t)(const void *)(
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
523 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
524 ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
525 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
526 ,
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
527 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
528 ) : (__builtin_constant_p (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
529 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
530 ) && ((size_t)(const void *)((
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
531 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
532 ) + 1) - (size_t)(const void *)(
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
533 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
534 ) == 1) && (__s1_len = __builtin_strlen (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
535 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
536 ), __s1_len < 4) ? (__builtin_constant_p (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
537 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
538 ) && ((size_t)(const void *)((
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
539 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
540 ) + 1) - (size_t)(const void *)(
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
541 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
542 ) == 1) ? __builtin_strcmp (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
543 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
544 ,
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
545 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
546 ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
547 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
548 ); int __result = (((const unsigned char *) (const char *) (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
549 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
550 ))[0] - __s2[0]); if (__s1_len > 0
__s1_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
551 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
552 ))[1] - __s2[1]); if (__s1_len > 1
__s1_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
553 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
554 ))[2] - __s2[2]); if (__s1_len > 2
__s1_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) __result = (((const unsigned char *) (const char *) (
never executed: __result = (((const unsigned char *) (const char *) ( ent->fts_path ))[3] - __s2[3]);
0
555 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( ent->fts_path ))[3] - __s2[3]);
0
556 ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
557 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
558 ) && ((size_t)(const void *)((
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
559 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
560 ) + 1) - (size_t)(const void *)(
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
561 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
562 ) == 1) && (__s2_len = __builtin_strlen (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
563 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
564 ), __s2_len < 4) ? (__builtin_constant_p (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
565 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
566 ) && ((size_t)(const void *)((
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
567 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
568 ) + 1) - (size_t)(const void *)(
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
569 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
570 ) == 1) ? __builtin_strcmp (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
571 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
572 ,
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
573 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
574 ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
575 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
576 ); int __result = (((const unsigned char *) (const char *) (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
577 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
578 ))[0] - __s2[0]); if (__s2_len > 0
__s2_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
579 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
580 ))[1] - __s2[1]); if (__s2_len > 1
__s2_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
581 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
582 ))[2] - __s2[2]); if (__s2_len > 2
__s2_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) __result = (((const unsigned char *) (const char *) (
never executed: __result = (((const unsigned char *) (const char *) ( "/" ))[3] - __s2[3]);
0
583 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( "/" ))[3] - __s2[3]);
0
584 ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
585 ent->fts_path
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
586 ,
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
587 "/"
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
588 )))); })
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
589 == 0)
( __extension_...)))); }) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
) error (0, 0,
never executed: error (0, 0, dcgettext (((void *)0), "it is dangerous to operate recursively on %s" , 5) , quotearg_style (shell_escape_always_quoting_style, ent->fts_path));
0
590 dcgettext (((void *)0),
never executed: error (0, 0, dcgettext (((void *)0), "it is dangerous to operate recursively on %s" , 5) , quotearg_style (shell_escape_always_quoting_style, ent->fts_path));
0
591 "it is dangerous to operate recursively on %s"
never executed: error (0, 0, dcgettext (((void *)0), "it is dangerous to operate recursively on %s" , 5) , quotearg_style (shell_escape_always_quoting_style, ent->fts_path));
0
592 , 5)
never executed: error (0, 0, dcgettext (((void *)0), "it is dangerous to operate recursively on %s" , 5) , quotearg_style (shell_escape_always_quoting_style, ent->fts_path));
0
593 , quotearg_style (shell_escape_always_quoting_style, ent->fts_path));
never executed: error (0, 0, dcgettext (((void *)0), "it is dangerous to operate recursively on %s" , 5) , quotearg_style (shell_escape_always_quoting_style, ent->fts_path));
else error (0, 0,
never executed: error (0, 0, dcgettext (((void *)0), "it is dangerous to operate recursively on %s (same as %s)" , 5) , quotearg_n_style (0, shell_escape_always_quoting_style, ent->fts_path), quotearg_n_style (1, shell_escape_always_quoting_style, "/"));
0
594 dcgettext (((void *)0),
never executed: error (0, 0, dcgettext (((void *)0), "it is dangerous to operate recursively on %s (same as %s)" , 5) , quotearg_n_style (0, shell_escape_always_quoting_style, ent->fts_path), quotearg_n_style (1, shell_escape_always_quoting_style, "/"));
0
595 "it is dangerous to operate recursively on %s (same as %s)"
never executed: error (0, 0, dcgettext (((void *)0), "it is dangerous to operate recursively on %s (same as %s)" , 5) , quotearg_n_style (0, shell_escape_always_quoting_style, ent->fts_path), quotearg_n_style (1, shell_escape_always_quoting_style, "/"));
0
596 , 5)
never executed: error (0, 0, dcgettext (((void *)0), "it is dangerous to operate recursively on %s (same as %s)" , 5) , quotearg_n_style (0, shell_escape_always_quoting_style, ent->fts_path), quotearg_n_style (1, shell_escape_always_quoting_style, "/"));
0
597 , quotearg_n_style (0, shell_escape_always_quoting_style, ent->fts_path), quotearg_n_style (1, shell_escape_always_quoting_style, "/"));
never executed: error (0, 0, dcgettext (((void *)0), "it is dangerous to operate recursively on %s (same as %s)" , 5) , quotearg_n_style (0, shell_escape_always_quoting_style, ent->fts_path), quotearg_n_style (1, shell_escape_always_quoting_style, "/"));
error (0, 0,
0
598 dcgettext (((void *)0), -
599 "use --no-preserve-root to override this failsafe"-
600 , 5)-
601 ); } while (0);-
602 fts_skip_tree (fts, ent);-
603 return
never executed: return RM_ERROR;
RM_ERROR;
never executed: return RM_ERROR;
0
604 }-
605 }
executed 4167 times by 2 tests: end of block
Executed by:
  • mv
  • rm
4167
606-
607 {-
608 Ternary is_empty_directory;-
609 enum RM_status s = prompt (fts, ent, -
610 1 -
611 , x,-
612 PA_DESCEND_INTO_DIR, &is_empty_directory);-
613-
614 if (s == RM_OK
s == RM_OKDescription
TRUEevaluated 56489 times by 2 tests
Evaluated by:
  • mv
  • rm
FALSEnever evaluated
&& is_empty_directory == T_YES
is_empty_directory == T_YESDescription
TRUEevaluated 40242 times by 2 tests
Evaluated by:
  • mv
  • rm
FALSEevaluated 16247 times by 2 tests
Evaluated by:
  • mv
  • rm
)
0-56489
615 {-
616-
617-
618 s = excise (fts, ent, x, -
619 1-
620 );-
621 fts_skip_tree (fts, ent);-
622 }
executed 40242 times by 2 tests: end of block
Executed by:
  • mv
  • rm
40242
623-
624 if (s != RM_OK
s != RM_OKDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • rm
FALSEevaluated 56488 times by 2 tests
Evaluated by:
  • mv
  • rm
)
1-56488
625 {-
626 mark_ancestor_dirs (ent);-
627 fts_skip_tree (fts, ent);-
628 }
executed 1 time by 1 test: end of block
Executed by:
  • rm
1
629-
630 return
executed 56489 times by 2 tests: return s;
Executed by:
  • mv
  • rm
s;
executed 56489 times by 2 tests: return s;
Executed by:
  • mv
  • rm
56489
631 }-
632-
633 case
executed 789 times by 2 tests: case 8:
Executed by:
  • mv
  • rm
8:
executed 789 times by 2 tests: case 8:
Executed by:
  • mv
  • rm
789
634 case
executed 500 times by 1 test: case 10:
Executed by:
  • rm
10:
executed 500 times by 1 test: case 10:
Executed by:
  • rm
500
635 case
executed 4 times by 2 tests: case 12:
Executed by:
  • mv
  • rm
12:
executed 4 times by 2 tests: case 12:
Executed by:
  • mv
  • rm
4
636 case
never executed: case 13:
13:
never executed: case 13:
0
637 case
executed 16239 times by 2 tests: case 6:
Executed by:
  • mv
  • rm
6:
executed 16239 times by 2 tests: case 6:
Executed by:
  • mv
  • rm
16239
638 case
executed 6 times by 1 test: case 4:
Executed by:
  • rm
4:
executed 6 times by 1 test: case 4:
Executed by:
  • rm
6
639 case
executed 248524 times by 2 tests: case 11:
Executed by:
  • mv
  • rm
11:
executed 248524 times by 2 tests: case 11:
Executed by:
  • mv
  • rm
248524
640 case
executed 1 time by 1 test: case 3:
Executed by:
  • mv
3:
executed 1 time by 1 test: case 3:
Executed by:
  • mv
1
641 {-
642-
643-
644-
645 if (ent->fts_info == 6
ent->fts_info == 6Description
TRUEevaluated 16239 times by 2 tests
Evaluated by:
  • mv
  • rm
FALSEevaluated 249824 times by 2 tests
Evaluated by:
  • mv
  • rm
16239-249824
646 && x->one_file_system
x->one_file_systemDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • rm
FALSEevaluated 16238 times by 2 tests
Evaluated by:
  • mv
  • rm
1-16238
647 && 0 < ent->fts_level
0 < ent->fts_levelDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • rm
0-1
648 && ent->fts_statp->st_dev != fts->fts_dev
ent->fts_statp...= fts->fts_devDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
649 {-
650 mark_ancestor_dirs (ent);-
651 error (0, 0, -
652 dcgettext (((void *)0), -
653 "skipping %s, since it's on a different device"-
654 , 5)-
655 ,-
656 quotearg_style (shell_escape_always_quoting_style, ent->fts_path));-
657 return
never executed: return RM_ERROR;
RM_ERROR;
never executed: return RM_ERROR;
0
658 }-
659-
660 -
661 _Bool -
662 is_dir = ent->fts_info == 6
ent->fts_info == 6Description
TRUEevaluated 16239 times by 2 tests
Evaluated by:
  • mv
  • rm
FALSEevaluated 249824 times by 2 tests
Evaluated by:
  • mv
  • rm
|| ent->fts_info == 4
ent->fts_info == 4Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 249818 times by 2 tests
Evaluated by:
  • mv
  • rm
;
6-249824
663 enum RM_status s = prompt (fts, ent, is_dir, x, PA_REMOVE_DIR, -
664 ((void *)0)-
665 );-
666 if (s != RM_OK
s != RM_OKDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 266045 times by 2 tests
Evaluated by:
  • mv
  • rm
)
18-266045
667 return
executed 18 times by 1 test: return s;
Executed by:
  • rm
s;
executed 18 times by 1 test: return s;
Executed by:
  • rm
18
668 return
executed 266045 times by 2 tests: return excise (fts, ent, x, is_dir);
Executed by:
  • mv
  • rm
excise (fts, ent, x, is_dir);
executed 266045 times by 2 tests: return excise (fts, ent, x, is_dir);
Executed by:
  • mv
  • rm
266045
669 }-
670-
671 case
never executed: case 2:
2:
never executed: case 2:
0
672 do { error (0, 0, -
673 dcgettext (((void *)0), -
674 "WARNING: Circular directory structure.\nThis almost certainly means that you have a corrupted file system.\nNOTIFY YOUR SYSTEM MANAGER.\nThe following directory is part of the cycle:\n %s\n"-
675 , 5)-
676 , quotearg_n_style_colon (0, shell_escape_quoting_style, ent->fts_path)); } while (0);-
677 fts_skip_tree (fts, ent);-
678 return
never executed: return RM_ERROR;
RM_ERROR;
never executed: return RM_ERROR;
0
679-
680 case
executed 1 time by 1 test: case 7:
Executed by:
  • rm
7:
executed 1 time by 1 test: case 7:
Executed by:
  • rm
1
681-
682-
683 error (0, ent->fts_errno, -
684 dcgettext (((void *)0), -
685 "traversal failed: %s"-
686 , 5)-
687 ,-
688 quotearg_n_style_colon (0, shell_escape_quoting_style, ent->fts_path));-
689 fts_skip_tree (fts, ent);-
690 return
executed 1 time by 1 test: return RM_ERROR;
Executed by:
  • rm
RM_ERROR;
executed 1 time by 1 test: return RM_ERROR;
Executed by:
  • rm
1
691-
692 default
never executed: default:
:
never executed: default:
0
693 error (0, 0, -
694 dcgettext (((void *)0), -
695 "unexpected failure: fts_info=%d: %s\n" "please report to %s"-
696 , 5)-
697 -
698 ,-
699 ent->fts_info,-
700 quotearg_n_style_colon (0, shell_escape_quoting_style, ent->fts_path),-
701 "bug-coreutils@gnu.org");-
702 abort ();
never executed: abort ();
0
703 }-
704}-
705-
706-
707-
708enum RM_status-
709rm (char *const *file, struct rm_options const *x)-
710{-
711 enum RM_status rm_status = RM_OK;-
712-
713 if (*
*fileDescription
TRUEevaluated 4403 times by 2 tests
Evaluated by:
  • mv
  • rm
FALSEnever evaluated
file
*fileDescription
TRUEevaluated 4403 times by 2 tests
Evaluated by:
  • mv
  • rm
FALSEnever evaluated
)
0-4403
714 {-
715 int bit_flags = (0x0200-
716 | 0x0008-
717 | 0x0010);-
718-
719 if (x->one_file_system
x->one_file_systemDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • rm
FALSEevaluated 4402 times by 2 tests
Evaluated by:
  • mv
  • rm
)
1-4402
720 bit_flags |= 0x0040;
executed 1 time by 1 test: bit_flags |= 0x0040;
Executed by:
  • rm
1
721-
722 FTS *fts = xfts_open (file, bit_flags, -
723 ((void *)0)-
724 );-
725-
726 while (1)-
727 {-
728 FTSENT *ent;-
729-
730 ent = fts_read (fts);-
731 if (ent ==
ent == ((void *)0)Description
TRUEevaluated 4403 times by 2 tests
Evaluated by:
  • mv
  • rm
FALSEevaluated 322563 times by 2 tests
Evaluated by:
  • mv
  • rm
4403-322563
732 ((void *)0)
ent == ((void *)0)Description
TRUEevaluated 4403 times by 2 tests
Evaluated by:
  • mv
  • rm
FALSEevaluated 322563 times by 2 tests
Evaluated by:
  • mv
  • rm
4403-322563
733 )-
734 {-
735 if (-
736 (*
(*__errno_location ()) != 0Description
TRUEnever evaluated
FALSEevaluated 4403 times by 2 tests
Evaluated by:
  • mv
  • rm
__errno_location ())
(*__errno_location ()) != 0Description
TRUEnever evaluated
FALSEevaluated 4403 times by 2 tests
Evaluated by:
  • mv
  • rm
0-4403
737 != 0
(*__errno_location ()) != 0Description
TRUEnever evaluated
FALSEevaluated 4403 times by 2 tests
Evaluated by:
  • mv
  • rm
)
0-4403
738 {-
739 error (0, -
740 (*__errno_location ())-
741 , -
742 dcgettext (((void *)0), -
743 "fts_read failed"-
744 , 5)-
745 );-
746 rm_status = RM_ERROR;-
747 }
never executed: end of block
0
748 break;
executed 4403 times by 2 tests: break;
Executed by:
  • mv
  • rm
4403
749 }-
750-
751 enum RM_status s = rm_fts (fts, ent, x);-
752-
753 -
754 ((-
755 ((s) == RM_OK || (s) == RM_USER_DECLINED || (s) == RM_ERROR)-
756 ) ? (void) (0) : __assert_fail (-
757 "VALID_STATUS (s)"-
758 , "src/remove.c", 574, __PRETTY_FUNCTION__))-
759 ;-
760 do { if ((
(s) == RM_ERRORDescription
TRUEevaluated 27 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 322536 times by 2 tests
Evaluated by:
  • mv
  • rm
s) == RM_ERROR
(s) == RM_ERRORDescription
TRUEevaluated 27 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 322536 times by 2 tests
Evaluated by:
  • mv
  • rm
|| ((
(s) == RM_USER_DECLINEDDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 322518 times by 2 tests
Evaluated by:
  • mv
  • rm
s) == RM_USER_DECLINED
(s) == RM_USER_DECLINEDDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 322518 times by 2 tests
Evaluated by:
  • mv
  • rm
&& (
(rm_status) == RM_OKDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 11 times by 1 test
Evaluated by:
  • rm
rm_status) == RM_OK
(rm_status) == RM_OKDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • rm
FALSEevaluated 11 times by 1 test
Evaluated by:
  • rm
)) (
executed 34 times by 1 test: (rm_status) = (s);
Executed by:
  • rm
rm_status) = (s);
executed 34 times by 1 test: (rm_status) = (s);
Executed by:
  • rm
} while (0);
7-322536
761 }
executed 322563 times by 2 tests: end of block
Executed by:
  • mv
  • rm
322563
762-
763 if (fts_close (fts) != 0
fts_close (fts) != 0Description
TRUEnever evaluated
FALSEevaluated 4403 times by 2 tests
Evaluated by:
  • mv
  • rm
)
0-4403
764 {-
765 error (0, -
766 (*__errno_location ())-
767 , -
768 dcgettext (((void *)0), -
769 "fts_close failed"-
770 , 5)-
771 );-
772 rm_status = RM_ERROR;-
773 }
never executed: end of block
0
774 }
executed 4403 times by 2 tests: end of block
Executed by:
  • mv
  • rm
4403
775-
776 return
executed 4403 times by 2 tests: return rm_status;
Executed by:
  • mv
  • rm
rm_status;
executed 4403 times by 2 tests: return rm_status;
Executed by:
  • mv
  • rm
4403
777}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.1.2