Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: canonicalize missing components #567

Merged
merged 1 commit into from
May 11, 2024
Merged

fix: canonicalize missing components #567

merged 1 commit into from
May 11, 2024

Conversation

thesayyn
Copy link
Collaborator

@thesayyn thesayyn commented May 10, 2024

In 2.x, tars stopped being direct inputs OCIImage actions, this meant that none of the tars passed by the user actually went into the sandbox. fixes #566

Imagine an oci_image in examples/env/image

bazel-out/darwin_arm64-fastbuild/bin/external/bash_amd64/data.tar.zst -> did fail because external segment does not exist, therefore can't be canonicalized.

bazel-out/darwin_arm64-fastbuild/bin/examples/env/image/data.tar.zst -> did NOT fail because all components in the path except the file itself existed, therefore can be canonicalized.

In the scenario above realpath failed if any of the directory segments in the path was missing leading to errors only when external repository labels passed to tars. This fixes the issue by telling realpath to ignore missing segments, and we don't care if the file actually exists on disk.

I changed examples/deb a bit so that genrule is in the external repo, providing us a test coverage for this.

Copy link
Collaborator

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice test case

@alexeagle alexeagle merged commit 500fa79 into 2.x May 11, 2024
18 checks passed
@alexeagle alexeagle deleted the canonicalize_missing branch May 11, 2024 14:59
thesayyn added a commit that referenced this pull request May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tar symlinks cannot find layer from external repository
2 participants