[5.6] Sandbox blocks output to default plugin output directory when it's under <pkgdir>/.build
#4018
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.
This is the 5.6 nomination of #4009.
Explanation: The sandbox rules introduced in #3996 made the entire package directory read-only, but that isn't appropriate when
.build
is inside the package directory. Swapping the order so that the sandbox applies the allow-write rules after the deny-write rules allows.build
(or whatever the output directory is) to be written to while keeping the rest of the package directory readonly to the plugin.Scope of Issue: This affects SwiftPM users who run command plugins that write to the plugin working directory and who are not customizing the intermediate-files directory using the
--build-path
option.Reason for Nominating to 5.6: This is a common use case in new functionality (command plugins).
Risk: Low — although the sandbox is used for manifest loading as well as running plugins, the ability to add custom writable locations is only used in the new functionality of command plugins.
Reviewed By: @tomerd
Automated Testing: A new unit test covers this case.
Dependencies: None
Impact on CI: None
How to Verify: Use a command plugin that writes intermediate files to the plugin working directory (as opposed to /tmp) and check that it works even when the SwiftPM intermediates directory is inside the package directory.
rdar://87417780