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 permission issues during layer handling #488

Merged
merged 3 commits into from
Aug 19, 2022
Merged

Conversation

Malax
Copy link
Member

@Malax Malax commented Aug 19, 2022

When a layer directory contains files/directories that cannot be deleted based on their permissions, layer handling might fail with hard to debug errors that lack the necessary context.

This PR fixes this in two ways. First, a dedicated DeleteLayerError has been introduced to add more context to potential IO errors. WriteLayerError and ReadLayerError existed already. Secondly, since the buildpack process usually has the necessary permissions to change the permissions of the layer contents, libcnb now attempts to fix the permissions of the layer contents before attempting to delete the layer.

I also added a new test-buildpacks directory that contains buildpacks like the ones in the examples directory. The buildpacks within are meant as integration tests for libcnb itself. The directory contains a README explaining the intent of that directory.

Changelog

  • Fix permission issues during layer handling when the layer contains read-only directories.
  • Add explicit DeleteLayerError to provide more context when debugging layer handling problems.

Fixes #475, GUS-W-11467784

@Malax Malax force-pushed the malax/fix-issue-475 branch from b195601 to 7708af6 Compare August 19, 2022 08:54
@Malax Malax marked this pull request as ready for review August 19, 2022 09:03
@Malax Malax requested a review from a team as a code owner August 19, 2022 09:03
Copy link
Contributor

@colincasey colincasey left a comment

Choose a reason for hiding this comment

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

👍 i like the direction of the test-buildpacks here

libcnb/src/util.rs Show resolved Hide resolved
@Malax Malax merged commit 109ba19 into main Aug 19, 2022
@Malax Malax deleted the malax/fix-issue-475 branch August 19, 2022 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change bug Something isn't working libcnb
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deleting layers with read-only directories
2 participants