OpenCoverageCoreutils

Coreutils patch #3 - Test report of the modifications

Overview

Test Execution StatusStatistics
Passed
  0.000% (0/108)
Failed
  0.000% (0/108)
Requires Manual Checking
  0.000% (0/108)
Unknown
  1.852% (2/108)
All
  1.852% (2/108)
CategoryRemoved LinesInserted LinesTotal
Modified lines executed:
 50.000% (18/36)
 28.205% (11/39)
 38.667% (29/75)
Modified lines not executed:
  0.000% (0/36)
  2.564% (1/39)
  1.333% (1/75)
Source code lines not covered:
 50.000% (18/36)
 69.231% (27/39)
 60.000% (45/75)

List of tests executing the changes

Execution NameState
cutUnknown
numfmtUnknown

Patch File

Showing: 

Modified File: NEWS

LineTestsDifference Output
diff --git a/NEWS b/NEWS
index 207e785b3..34652b59d 100644
--- a/NEWS
+++ b/NEWS
@@ -30,6 +30,9 @@ GNU coreutils NEWS -*- outline -*-
30
31 ** Improvements
32
33
-
+ cut supports line lengths up to the max file size on 32 bit systems.
34
-
+ Previously only offsets up to SIZE_MAX-1 were supported.
35
-
+
33 ➡ 36 stat and tail now know about the "exfs" file system, which is a
34 ➡ 37 version of XFS. stat -f --format=%T now reports the file system type,
35 ➡ 38 and tail -f uses inotify.

Modified File: src/cut.c

LineTestsDifference Output
diff --git a/src/cut.c b/src/cut.c
index be2e67af4..5dc511af3 100644
--- a/src/cut.c
+++ b/src/cut.c
@@ -204,7 +204,7 @@ Each range is one of:\n\
204 and if required CURRENT_RP. */
205
206 static inline void
207
1
Executed by:
  • cut
-next_item (size_t *item_idx)
207
-
+next_item (uintmax_t *item_idx)
208 {
209 (*item_idx)++;
210 if ((*item_idx) > current_rp->hi)
@@ -214,7 +214,7 @@ next_item (size_t *item_idx)
214 /* Return nonzero if the K'th field or byte is printable. */
215
216 static inline bool
217
1
Executed by:
  • cut
-print_kth (size_t k)
217
-
+print_kth (uintmax_t k)
218 {
219 return current_rp->lo <= k;
220 }
@@ -222,7 +222,7 @@ print_kth (size_t k)
222 /* Return nonzero if K'th byte is the beginning of a range. */
223
224 static inline bool
225
1
Executed by:
  • cut
-is_range_start_index (size_t k)
225
-
+is_range_start_index (uintmax_t k)
226 {
227 return k == current_rp->lo;
228 }
@@ -232,7 +232,7 @@ is_range_start_index (size_t k)
232 static void
233 cut_bytes (FILE *stream)
234 {
235
1
Executed by:
  • cut
- size_t byte_idx; /* Number of bytes in the line so far. */
235
1
Executed by:
  • cut
+ uintmax_t byte_idx; /* Number of bytes in the line so far. */
236 /* Whether to begin printing delimiters between ranges for the current line.
237 Set after we've begun printing data corresponding to the first range. */
238 bool print_delimiter;
@@ -286,7 +286,7 @@ static void
286 cut_fields (FILE *stream)
287 {
288 int c;
289
1
Executed by:
  • cut
- size_t field_idx = 1;
289
1
Executed by:
  • cut
+ uintmax_t field_idx = 1;
290 bool found_any_selected_field = false;
291 bool buffer_first_field;
292

Modified File: src/numfmt.c

LineTestsDifference Output
diff --git a/src/numfmt.c b/src/numfmt.c
index 130e0388d..ce5c131e4 100644
--- a/src/numfmt.c
+++ b/src/numfmt.c
@@ -1351,13 +1351,13 @@ next_field (char **line)
1351 }
1352
1353 static bool _GL_ATTRIBUTE_PURE
1354
1
Executed by:
  • numfmt
-include_field (size_t field)
1354
-
+include_field (uintmax_t field)
1355 {
1356 struct field_range_pair *p = frp;
1357 if (!p)
1358 return field == 1;
1359
1360
1
Executed by:
  • numfmt
- while (p->lo != SIZE_MAX)
1360
1
Executed by:
  • numfmt
+ while (p->lo != UINTMAX_MAX)
1361 {
1362 if (p->lo <= field && p->hi >= field)
1363 return true;
@@ -1369,7 +1369,7 @@ include_field (size_t field)
1369 /* Convert and output the given field. If it is not included in the set
1370 of fields to process just output the original */
1371 static bool
1372
1
Executed by:
  • numfmt
-process_field (char *text, size_t field)
1372
-
+process_field (char *text, uintmax_t field)
1373 {
1374 long double val = 0;
1375 size_t precision = 0;
@@ -1400,7 +1400,7 @@ static int
1400 process_line (char *line, bool newline)
1401 {
1402 char *next;
1403
1
Executed by:
  • numfmt
- size_t field = 0;
1403
1
Executed by:
  • numfmt
+ uintmax_t field = 0;
1404 bool valid_number = true;
1405
1406 while (true) {

Modified File: src/set-fields.c

LineTestsDifference Output
diff --git a/src/set-fields.c b/src/set-fields.c
index 20687b293..0119e3f99 100644
--- a/src/set-fields.c
+++ b/src/set-fields.c
@@ -45,7 +45,7 @@ static size_t n_frp_allocated;
45 space if necessary. Update global variable N_FRP. When allocating,
46 update global variable N_FRP_ALLOCATED. */
47 static void
48
2
Executed by:
  • cut
  • numfmt
-add_range_pair (size_t lo, size_t hi)
48
-
+add_range_pair (uintmax_t lo, uintmax_t hi)
49 {
50 if (n_frp == n_frp_allocated)
51 frp = X2NREALLOC (frp, &n_frp_allocated);
@@ -89,8 +89,8 @@ complement_rp (void)
89 add_range_pair (c[i-1].hi + 1, c[i].lo - 1);
90 }
91
92
1
Executed by:
  • cut
- if (c[n-1].hi < SIZE_MAX)
93
1
Executed by:
  • cut
- add_range_pair (c[n-1].hi + 1, SIZE_MAX);
92
1
Executed by:
  • cut
+ if (c[n-1].hi < UINTMAX_MAX)
93
0
+ add_range_pair (c[n-1].hi + 1, UINTMAX_MAX);
94
95 free (c);
96 }
@@ -100,7 +100,7 @@ complement_rp (void)
100 be composed of one or more numbers or ranges of numbers, separated
101 by blanks or commas. Incomplete ranges may be given: '-m' means '1-m';
102 'n-' means 'n' through end of line.
103
-
No equivalent source code line in the reference code can be identified.
- n=0 and n>=SIZE_MAX values will trigger an error.
103
-
+ n=0 and n>=UINTMAX_MAX values will trigger an error.
104
105 if SETFLD_ALLOW_DASH option is used, a single '-' means all fields
106 (otherwise a single dash triggers an error).
@@ -121,24 +121,24 @@ complement_rp (void)
121
122 The first field is stored as 1 (zero is not used).
123 An open-ended range (i.e., until the last field of the input line)
124
-
No equivalent source code line in the reference code can be identified.
- is indicated with hi = SIZE_MAX.
124
-
+ is indicated with hi = UINTMAX_MAX.
125
126
-
No equivalent source code line in the reference code can be identified.
- A sentinel of SIZE_MAX/SIZE_MAX is always added as the last
126
-
+ A sentinel of UINTMAX_MAX/UINTMAX_MAX is always added as the last
127 field range pair.
128
129 Examples:
130
-
No equivalent source code line in the reference code can be identified.
- given '1-2,4', frp = [ { .lo = 1, .hi = 2 },
131
-
No equivalent source code line in the reference code can be identified.
- { .lo = 4, .hi = 4 },
132
-
No equivalent source code line in the reference code can be identified.
- { .lo = SIZE_MAX, .hi = SIZE_MAX } ];
130
-
+ given '1-2,4', frp = [ { .lo = 1, .hi = 2 },
131
-
+ { .lo = 4, .hi = 4 },
132
-
+ { .lo = UINTMAX_MAX, .hi = UINTMAX_MAX } ];
133
134
-
No equivalent source code line in the reference code can be identified.
- given '3-', frp = [ { .lo = 3, .hi = SIZE_MAX },
135
-
No equivalent source code line in the reference code can be identified.
- { .lo = SIZE_MAX, .hi = SIZE_MAX } ];
134
-
+ given '3-', frp = [ { .lo = 3, .hi = UINTMAX_MAX },
135
-
+ { .lo = UINTMAX_MAX, .hi = UINTMAX_MAX } ];
136 */
137 void
138 set_fields (const char *fieldstr, unsigned int options)
139 {
140
2
Executed by:
  • cut
  • numfmt
- size_t initial = 1; /* Value of first number in a range. */
141
2
Executed by:
  • cut
  • numfmt
- size_t value = 0; /* If nonzero, a number being accumulated. */
140
2
Executed by:
  • cut
  • numfmt
+ uintmax_t initial = 1; /* Value of first number in a range. */
141
2
Executed by:
  • cut
  • numfmt
+ uintmax_t value = 0; /* If nonzero, a number being accumulated. */
142 bool lhs_specified = false;
143 bool rhs_specified = false;
144 bool dash_found = false; /* True if a '-' is found in this field. */
@@ -201,7 +201,7 @@ set_fields (const char *fieldstr, unsigned int options)
201 if (!rhs_specified)
202 {
203 /* 'n-'. From 'initial' to end of line. */
204
2
Executed by:
  • cut
  • numfmt
- add_range_pair (initial, SIZE_MAX);
204
2
Executed by:
  • cut
  • numfmt
+ add_range_pair (initial, UINTMAX_MAX);
205 }
206 else
207 {
@@ -247,8 +247,8 @@ set_fields (const char *fieldstr, unsigned int options)
247 lhs_specified = 1;
248
249 /* Detect overflow. */
250
2
Executed by:
  • cut
  • numfmt
- if (!DECIMAL_DIGIT_ACCUMULATE (value, *fieldstr - '0', size_t)
251
2
Executed by:
  • cut
  • numfmt
- || value == SIZE_MAX)
250
2
Executed by:
  • cut
  • numfmt
+ if (!DECIMAL_DIGIT_ACCUMULATE (value, *fieldstr - '0', uintmax_t)
251
2
Executed by:
  • cut
  • numfmt
+ || value == UINTMAX_MAX)
252 {
253 /* In case the user specified -c$(echo 2^64|bc),22,
254 complain only about the first number. */
@@ -307,7 +307,7 @@ set_fields (const char *fieldstr, unsigned int options)
307 and for performance reasons. */
308 ++n_frp;
309 frp = xrealloc (frp, n_frp * sizeof (struct field_range_pair));
310
2
Executed by:
  • cut
  • numfmt
- frp[n_frp - 1].lo = frp[n_frp - 1].hi = SIZE_MAX;
310
2
Executed by:
  • cut
  • numfmt
+ frp[n_frp - 1].lo = frp[n_frp - 1].hi = UINTMAX_MAX;
311 }
312
313 void

Modified File: src/set-fields.h

LineTestsDifference Output
diff --git a/src/set-fields.h b/src/set-fields.h
index b9bab1fd5..06f5ba8f3 100644
--- a/src/set-fields.h
+++ b/src/set-fields.h
@@ -19,8 +19,8 @@
19
20 struct field_range_pair
21 {
22
-
No equivalent source code line in the reference code can be identified.
- size_t lo;
23
-
No equivalent source code line in the reference code can be identified.
- size_t hi;
22
-
+ uintmax_t lo;
23
-
+ uintmax_t hi;
24 };
25
26 /* Array of `struct range_pair' holding all the finite ranges. */

Modified File: tests/misc/cut-huge-range.sh

LineTestsDifference Output
diff --git a/tests/misc/cut-huge-range.sh b/tests/misc/cut-huge-range.sh
index e7c17c222..76ca965e3 100755
--- a/tests/misc/cut-huge-range.sh
+++ b/tests/misc/cut-huge-range.sh
@@ -44,11 +44,9 @@ subtract_one='
44 '
45
46 # Ensure we can cut up to our sentinel value.
47
-
No equivalent source code line in the reference code can be identified.
-# This is currently SIZE_MAX, but could be raised to UINTMAX_MAX
48
-
No equivalent source code line in the reference code can be identified.
-# if we didn't allocate memory for each line as a unit.
49 ➡ 47 # Don't use expr to subtract one,
50
-
No equivalent source code line in the reference code can be identified.
-# since SIZE_MAX may exceed its maximum value.
51
-
No equivalent source code line in the reference code can be identified.
-CUT_MAX=$(echo $SIZE_MAX | sed "$subtract_one")
48
-
+# since UINTMAX_MAX may exceed its maximum value.
49
-
+CUT_MAX=$(echo $UINTMAX_MAX | sed "$subtract_one")
52 ➡ 50
53 ➡ 51 # From coreutils-8.10 through 8.20, this would make cut try to allocate
54 ➡ 52 # a 256MiB bit vector.
@@ -59,8 +57,10 @@ CUT_MAX=$(echo $SIZE_MAX | sed "$subtract_one")
59 ➡ 57 (ulimit -v $vm && cut -b1-$CUT_MAX /dev/null >> err 2>&1) || fail=1
60 ➡ 58
61 ➡ 59 # Explicitly disallow values above CUT_MAX
62
-
No equivalent source code line in the reference code can be identified.
-(ulimit -v $vm && returns_ 1 cut -b$SIZE_MAX /dev/null 2>/dev/null) || fail=1
63
-
No equivalent source code line in the reference code can be identified.
-(ulimit -v $vm && returns_ 1 cut -b$SIZE_OFLOW /dev/null 2>/dev/null) || fail=1
60
-
+(ulimit -v $vm && returns_ 1 cut -b$UINTMAX_MAX /dev/null 2>/dev/null) ||
61
-
+ fail=1
62
-
+(ulimit -v $vm && returns_ 1 cut -b$UINTMAX_OFLOW /dev/null 2>/dev/null) ||
63
-
+ fail=1
64
65 compare /dev/null err || fail=1
66

Modified File: tests/misc/numfmt.pl

LineTestsDifference Output
diff --git a/tests/misc/numfmt.pl b/tests/misc/numfmt.pl
index 6b3623399..94a7caf9d 100755
--- a/tests/misc/numfmt.pl
+++ b/tests/misc/numfmt.pl
@@ -308,9 +308,9 @@ my @Tests =
308 {EXIT=>1}, {ERR=>"$prog: invalid field range\n$try"}],
309 ['field-range-err-12','--field 0-1 --to=si 10',
310 {EXIT=>1}, {ERR=>"$prog: fields are numbered from 1\n$try"}],
311
-
No equivalent source code line in the reference code can be identified.
- ['field-range-err-13','--field '.$limits->{SIZE_MAX}.',22 --to=si 10',
311
-
+ ['field-range-err-13','--field '.$limits->{UINTMAX_MAX}.',22 --to=si 10',
312 {EXIT=>1}, {ERR=>"$prog: field number " .
313
-
No equivalent source code line in the reference code can be identified.
- "'".$limits->{SIZE_MAX}."' is too large\n$try"}],
313
-
+ "'".$limits->{UINTMAX_MAX}."' is too large\n$try"}],
314
315 # Auto-consume white-space, setup auto-padding
316 ['whitespace-1', '--to=si --field 2 "A 500 B"', {OUT=>"A 500 B"}],

Generated by Squish Coco 4.1.2