Commit 094aeab
committed
fix tar handler: truncated tar files were not processed correctly
Truncated tar files had a performance impact due to an EOFError not
being caught and thus the tar file not being recognized, and this
got repeated for every file in the truncated tar file.
Details:
`tarfile.TarFile.next()` does not handle well, when `fileobj.seek`
raises an exception: it will not handle it, so the exception will get
escalated to the caller, which in turn did not handle it either causing
a truncated tar file skipped by the tar handler (in a rather expensive
way: throwing away significant work determining the tar chunk's end).
The below solution makes sure exceptions escaping tarfile.TarFile.next()
are handled.
----
`File.seek` was incorrectly converting `ValueError` to `EOFError`.
It is fixed by raising a `File.seek` specific subclass of `ValueError`.1 parent bf11d02 commit 094aeab
File tree
49 files changed
+175
-15
lines changed- tests/integration/archive/tar
- __input__
- __output__
- damaged.gnu.tar_extract
- 0-1024.tar_extract
- 2048-10240.tar_extract
- truncated-cherry.posix.tar_extract
- 0-80896.tar_extract
- banana.gnu.tar_extract
- apple.gnu.tar_extract
- apple.posix.tar_extract
- banana.posix.tar_extract
- apple.gnu.tar_extract
- apple.posix.tar_extract
- truncated-header.tar_extract
- unblob
- handlers
- archive
- compression
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
49 files changed
+175
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
0 commit comments