Skip to content

Sandbox blocks output to default plugin output directory when it's under <pkgdir>/.build #4009

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

Merged
merged 1 commit into from
Jan 13, 2022

Conversation

abertelrud
Copy link
Contributor

@abertelrud abertelrud commented Jan 13, 2022

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.

Motivation

This fixes a bug with package command plugins such as DocC that write into the package working directory, in the particular case in which that working directory is inside the package directory (as in the .build default case).

Changes

  • in the generated sandbox profile, swap the order of the explicit readable and writable properties
  • add a new unit test for this case (existing ones check the other cases)

The rules for applying read-only directories were intended to shadow the implicit rules added by specifying a writable temporary directory, not to block the ones specified by explicit writable directories. This fixes that ordering, and adds the missing unit test that would have caught the problem.

A future change reworks Sandbox completely so that it becomes a struct that can carry around the sandbox profile configuration until it is applied — this change is intended to be small enough to be nominatable

rdar://87417780

@abertelrud abertelrud self-assigned this Jan 13, 2022
@abertelrud
Copy link
Contributor Author

@swift-ci please smoke test

…der `<pkgdir>/.build`

The sandbox rules introduced in swiftlang#3996 made the entire package directory read-only, but that isn't appropriate when `.build` is inside the package directory.

The rules for applying read-only directories were intended to shadow the implicit rules added by specifying a writable temporary directory, not to block the ones specified by explicit writable directories.  This fixes that ordering, and adds the missing unit test that would have caught the problem.

A future change reworks Sandbox completely so that it becomes a struct that can carry around the sandbox profile configuration until it is applied — this change is intended to be small enough to be nominatable

rdar://87417780
@abertelrud abertelrud force-pushed the eng/sandbox-order-fixes branch from da2e1da to 08dab5f Compare January 13, 2022 05:30
@abertelrud
Copy link
Contributor Author

@swift-ci please smoke test

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.

2 participants