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

[5.6] Cherry-pick TOFU changes from main branch #3930

Merged
merged 4 commits into from
Dec 15, 2021

Conversation

yim-lee
Copy link
Contributor

@yim-lee yim-lee commented Dec 10, 2021

Cherry-pick #3928, #3936, #3932, #3941 to 5.6

@yim-lee
Copy link
Contributor Author

yim-lee commented Dec 10, 2021

@swift-ci please test

@tomerd tomerd added the 5.6 label Dec 10, 2021
@yim-lee
Copy link
Contributor Author

yim-lee commented Dec 11, 2021

@swift-ci please test

@tomerd
Copy link
Contributor

tomerd commented Dec 11, 2021

@swift-ci please test linux

@yim-lee yim-lee changed the title [5.6] Disable fingerprint checking when storage is not available [5.6] Cherry-pick TOFU changes from main branch Dec 11, 2021
@yim-lee yim-lee self-assigned this Dec 13, 2021
Motivation:

Source compat test failure: https://ci.swift.org/job/swift-PR-source-compat-suite/5701/artifact/swift-source-compat-suite/

```
error: Failed to get source control fingerprint for swift-log remoteSourceControl /~https://github.com/apple/swift-log.git version 1.4.2 from storage: Error Domain=NSCocoaErrorDomain Code=513 "You don't have permission to save the file "fingerprints" in the folder "security"." UserInfo={NSFilePath=/Users/buildnode/.swiftpm/security/fingerprints, NSUnderlyingError=0x7feaae439370 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
error: Error Domain=NSCocoaErrorDomain Code=513 "You don't have permission to save the file "fingerprints" in the folder "security"." UserInfo={NSFilePath=/Users/buildnode/.swiftpm/security/fingerprints, NSUnderlyingError=0x7feaae439370 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
```

Modifications:
- Make `PackageFingerprintStorage` optional in `RegistryClient` and `SourceControlPackageContainer`, which would turn off fingerprint read/write and essentially disable the TOFU feature.
- `SwiftTool` will try to create the shared security directory (under which fingerprints are stored), and if it fails (e.g., permission errors) set `PackageFingerprintStorage` to none.
- Don't perform integrity check on fingerprint write. The validation failure will happen on read.
Per review feedback, reverting part of the changes introduced in swiftlang#3928.
…ang#3941)

Motivation:
Source compat test continues to fail even with swiftlang#3928:

```
"You don’t have permission to save the file “fingerprints” in the folder “security”
```

https://ci.swift.org/job/swift-PR-source-compat-suite/5709/artifact/

The tests we did with swiftlang#3938 shows that we can create directories but not write files.

Modifications:
Test creating `security` directory and writing file in it, and disable TOFU feature if the test fails.
@yim-lee
Copy link
Contributor Author

yim-lee commented Dec 14, 2021

@swift-ci please test

@yim-lee
Copy link
Contributor Author

yim-lee commented Dec 14, 2021

@swift-ci please test

@yim-lee yim-lee merged commit 492c356 into swiftlang:release/5.6 Dec 15, 2021
@yim-lee yim-lee deleted the optional-tofu-5.6 branch December 15, 2021 04:43
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.

3 participants