Skip to content

Commit

Permalink
Add failing tests
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
pombredanne committed Oct 8, 2021
1 parent 533ac8a commit 7f007db
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
Binary file not shown.
1 change: 1 addition & 0 deletions tests/data/extract/replace-originals/issue6550.gz.ABOUT
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
download_url: https://golang.org/src/compress/gzip/testdata/issue6550.gz.base64
Binary file added tests/data/extract/replace-originals/rake.1.gz
Binary file not shown.
1 change: 1 addition & 0 deletions tests/data/extract/replace-originals/rake.1.gz.ABOUT
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
download_url: https://github.com/ruby/rake/blob/v0.9.2.2/doc/rake.1.gz?raw=true
16 changes: 16 additions & 0 deletions tests/test_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,22 @@ def test_extract_tree_recursive_replace_originals(self):
check_no_error(result)
check_files(test_dir, expected)

def test_extract_with_replace_originals_does_not_fail_with_gz_with_trailing(self):
expected = (
)
test_dir = self.get_test_loc('extract/replace-originals/rake.1.gz', copy=True)
result = list(extract.extract(test_dir, recurse=True, replace_originals=True))
check_no_error(result)
check_files(test_dir, expected)

def test_extract_with_replace_originals_does_not_fail_with_corrupted_archive(self):
expected = (
)
test_dir = self.get_test_loc('extract/replace-originals/issue6550.gz', copy=True)
result = list(extract.extract(test_dir, recurse=True, replace_originals=True))
check_no_error(result)
check_files(test_dir, expected)

def test_extract_tree_shallow_then_recursive(self):
shallow = (
'a/a.tar.gz',
Expand Down

0 comments on commit 7f007db

Please sign in to comment.