Fix permission issues during layer handling #488
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
andReadLayerError
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 theexamples
directory. The buildpacks within are meant as integration tests for libcnb itself. The directory contains a README explaining the intent of that directory.Changelog
DeleteLayerError
to provide more context when debugging layer handling problems.Fixes #475, GUS-W-11467784