Skip to content

Commit 7f007db

Browse files
committed
Add failing tests
These archive should not crash extraction when using --replace-originals Reported-by: Smascer @Smascer Reported-by: Bryan Sutula @sutula Reference: #31 Reference: aboutcode-org/scancode-toolkit#2723 Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent 533ac8a commit 7f007db

File tree

5 files changed

+18
-0
lines changed

5 files changed

+18
-0
lines changed
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
download_url: https://golang.org/src/compress/gzip/testdata/issue6550.gz.base64
1.34 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
download_url: https://github.com/ruby/rake/blob/v0.9.2.2/doc/rake.1.gz?raw=true

tests/test_extract.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,22 @@ def test_extract_tree_recursive_replace_originals(self):
273273
check_no_error(result)
274274
check_files(test_dir, expected)
275275

276+
def test_extract_with_replace_originals_does_not_fail_with_gz_with_trailing(self):
277+
expected = (
278+
)
279+
test_dir = self.get_test_loc('extract/replace-originals/rake.1.gz', copy=True)
280+
result = list(extract.extract(test_dir, recurse=True, replace_originals=True))
281+
check_no_error(result)
282+
check_files(test_dir, expected)
283+
284+
def test_extract_with_replace_originals_does_not_fail_with_corrupted_archive(self):
285+
expected = (
286+
)
287+
test_dir = self.get_test_loc('extract/replace-originals/issue6550.gz', copy=True)
288+
result = list(extract.extract(test_dir, recurse=True, replace_originals=True))
289+
check_no_error(result)
290+
check_files(test_dir, expected)
291+
276292
def test_extract_tree_shallow_then_recursive(self):
277293
shallow = (
278294
'a/a.tar.gz',

0 commit comments

Comments
 (0)