Commit c5a0e55
authored
Add tests for exotic external tar asset archives, fix some more corner case bugs (#74412)
* Remove unused _readFirstEntry. Remnant from before we created PaxGlobalExtendedAttributesEntry.
* Set the position of the freshly copied data stream to 0, so the first user access of the DataStream property gives them a stream ready to read from the beginning.
* Process a PAX actual entry's data block only after the extended attributes are analyzed, in case the size is found as an extended attribute and needs to be overriden.
* Add tests to verify the entries of the new external tar assets can be read. Verify their DataStream if available.
* Add copyData argument to recent alignment padding tests.
* Throw an exception sooner and with a clearer message when a data section is unexpected for the entry type.
* Allow trailing nulls and spaces in octal fields.
Co-authored-by: @am11 Adeel Mujahid <3840695+am11@users.noreply.github.com>
* Throw a clearer exception if the unsupported sparse file entry type is encountered. These entries have additional data that indicates the locations of sparse bytes, which cannot be read with just the size field. So to avoid accidentally offseting the reader, we throw.
* Tests.
* Rename to TrimLeadingNullsAndSpaces
Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>1 parent 97613f3 commit c5a0e55
File tree
9 files changed
+705
-65
lines changed- src/libraries/System.Formats.Tar
- src
- Resources
- System/Formats/Tar
- tests
- TarReader
9 files changed
+705
-65
lines changedLines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
208 | 211 | | |
209 | 212 | | |
210 | 213 | | |
| |||
Lines changed: 19 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
202 | 206 | | |
203 | 207 | | |
204 | 208 | | |
| |||
257 | 261 | | |
258 | 262 | | |
259 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
260 | 268 | | |
261 | 269 | | |
262 | 270 | | |
| |||
311 | 319 | | |
312 | 320 | | |
313 | 321 | | |
| 322 | + | |
| 323 | + | |
314 | 324 | | |
315 | 325 | | |
316 | 326 | | |
| |||
336 | 346 | | |
337 | 347 | | |
338 | 348 | | |
| 349 | + | |
| 350 | + | |
339 | 351 | | |
340 | 352 | | |
341 | 353 | | |
| |||
396 | 408 | | |
397 | 409 | | |
398 | 410 | | |
399 | | - | |
400 | 411 | | |
401 | 412 | | |
402 | 413 | | |
403 | 414 | | |
404 | 415 | | |
| 416 | + | |
| 417 | + | |
405 | 418 | | |
406 | 419 | | |
407 | 420 | | |
| |||
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
206 | 212 | | |
207 | 213 | | |
208 | 214 | | |
| |||
243 | 249 | | |
244 | 250 | | |
245 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
246 | 263 | | |
247 | 264 | | |
248 | 265 | | |
| |||
351 | 368 | | |
352 | 369 | | |
353 | 370 | | |
354 | | - | |
| 371 | + | |
355 | 372 | | |
356 | 373 | | |
357 | 374 | | |
Lines changed: 18 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
44 | 43 | | |
45 | 44 | | |
46 | 45 | | |
47 | | - | |
48 | 46 | | |
49 | 47 | | |
50 | 48 | | |
| |||
124 | 122 | | |
125 | 123 | | |
126 | 124 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | 125 | | |
133 | 126 | | |
134 | 127 | | |
| |||
282 | 275 | | |
283 | 276 | | |
284 | 277 | | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | 278 | | |
291 | 279 | | |
292 | 280 | | |
| |||
319 | 307 | | |
320 | 308 | | |
321 | 309 | | |
322 | | - | |
| 310 | + | |
323 | 311 | | |
324 | 312 | | |
325 | 313 | | |
| |||
361 | 349 | | |
362 | 350 | | |
363 | 351 | | |
364 | | - | |
| 352 | + | |
365 | 353 | | |
366 | 354 | | |
367 | 355 | | |
| |||
397 | 385 | | |
398 | 386 | | |
399 | 387 | | |
400 | | - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
401 | 391 | | |
402 | | - | |
403 | 392 | | |
404 | 393 | | |
405 | 394 | | |
| |||
417 | 406 | | |
418 | 407 | | |
419 | 408 | | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
420 | 412 | | |
421 | 413 | | |
422 | 414 | | |
| |||
426 | 418 | | |
427 | 419 | | |
428 | 420 | | |
429 | | - | |
430 | | - | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
431 | 424 | | |
432 | 425 | | |
433 | 426 | | |
| |||
451 | 444 | | |
452 | 445 | | |
453 | 446 | | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
454 | 450 | | |
455 | 451 | | |
456 | 452 | | |
| |||
460 | 456 | | |
461 | 457 | | |
462 | 458 | | |
463 | | - | |
| 459 | + | |
464 | 460 | | |
465 | 461 | | |
466 | 462 | | |
| |||
478 | 474 | | |
479 | 475 | | |
480 | 476 | | |
481 | | - | |
| 477 | + | |
482 | 478 | | |
483 | 479 | | |
484 | 480 | | |
| |||
537 | 533 | | |
538 | 534 | | |
539 | 535 | | |
540 | | - | |
| 536 | + | |
541 | 537 | | |
542 | 538 | | |
543 | 539 | | |
| |||
556 | 552 | | |
557 | 553 | | |
558 | 554 | | |
559 | | - | |
| 555 | + | |
560 | 556 | | |
561 | 557 | | |
562 | 558 | | |
| |||
0 commit comments