Skip to content

Commit

Permalink
Correctly extract symlinks #407 #471 (#479)
Browse files Browse the repository at this point in the history
* Correctly extract symlinks #407 #471

Use the latest container-inspector to fix symlinks extraction.
In particular broken synlinks are not treated as an error anymore
and symlinks are extracted correctly.

Reference: #471
Reference: #407
Signed-off-by: Philippe Ombredanne <[email protected]>

* Update container_inspector to 32.0.1 version #407 #471

Co-authored-by: Philippe Ombredanne <[email protected]>

Co-authored-by: tdruez <[email protected]>
  • Loading branch information
pombredanne and tdruez authored Aug 1, 2022
1 parent 7d084c7 commit 11c29c0
Show file tree
Hide file tree
Showing 13 changed files with 42,559 additions and 47,046 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ v31.0.0 (next)

https://github.com/nexB/scancode.io/issues/413

- Correctly extract symlinks in docker images. We now usse the latest
container-inspector to fix symlinks extraction in docker image tarballs.
In particular broken synlinks are not treated as an error anymore
and symlinks are extracted correctly.
https://github.com/nexB/scancode.io/issues/471
https://github.com/nexB/scancode.io/issues/407


v30.2.0 (2021-12-17)
--------------------

Expand Down
9 changes: 8 additions & 1 deletion scanpipe/pipes/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ def extract_image_from_tarball(input_tarball, extract_target, verify=True):
Returns the `images` and an `errors` list of error messages that may have
happened during the extraction.
"""
errors = extract_tar(location=input_tarball, target_dir=extract_target)
errors = extract_tar(
location=input_tarball,
target_dir=extract_target,
skip_symlinks=False,
as_events=False,
)
images = Image.get_images_from_dir(
extracted_location=str(extract_target),
verify=verify,
Expand Down Expand Up @@ -104,6 +109,8 @@ def extract_layers_from_images_to_base_path(base_path, images):
extract_errors = extract_tar(
location=layer.archive_location,
target_dir=extract_target,
skip_symlinks=False,
as_events=False,
)
errors.extend(extract_errors)
layer.extracted_location = str(extract_target)
Expand Down
Loading

0 comments on commit 11c29c0

Please sign in to comment.