Skip to content

Conversation

@neonichu
Copy link
Contributor

@neonichu neonichu commented Jan 24, 2024

  • Explanation:

SwiftPM is code signing any binaries it produces on macOS in 5.10. Whenever a binary get relinked and resigned during incremental builds, it verbatim emits informational diagnostics to the log, which should only happen in verbose mode. Especially in projects which multiple binaries, this can make the log difficult to follow and may lead to confusion of users.

  • Scope: Any users on macOS will see this issue.
  • Risk: In theory, this change could lead to other diagnostics not being emitted, but the change is scoped to only code signing tasks, so the risk for this is very low.
  • Testing: Some new tests for SwiftPM's logging were added as part of this.
  • Reviewer: @MaxDesiatov
  • Main branch PR: Filter codesign messages #7285

@neonichu neonichu added the swift 5.10 This PR targets the 5.10 branch label Jan 24, 2024
@neonichu neonichu self-assigned this Jan 24, 2024
@neonichu
Copy link
Contributor Author

@swift-ci please test

@neonichu
Copy link
Contributor Author

[1623/1623] Testing BasicsTests.ZipArchiverTests/testZipArchiverInvalidArchive
Test Suite 'Selected tests' started at 2024-01-24 18:48:44.080.Test Suite 'SwiftPMPackageTests.xctest' started at 2024-01-24 18:48:44.081.Test Suite 'BuildSystemDelegateTests' started at 2024-01-24 18:48:44.081.Test Case '-[BuildTests.BuildSystemDelegateTests testDoNotFilterLinkerDiagnostics]' started./Users/ec2-user/jenkins/workspace/swift-package-manager-with-xcode-self-hosted-PR-osx/branch-release/5.10/swiftpm/Sources/SPMTestSupport/misc.swift:144: error: -[BuildTests.BuildSystemDelegateTests testDoNotFilterLinkerDiagnostics] : failed: caught error: "terminated(1): /Users/ec2-user/jenkins/workspace/swift-package-manager-with-xcode-self-hosted-PR-osx/branch-release/5.10/swiftpm/.build/x86_64-apple-macosx/debug/swift-build --package-path /var/folders/bb/hcrjxg1s0b96pfst0ymhmp240000gn/T/Miscellaneous_DoNotFilterLinkerDiagnostics.U8r9nF/Miscellaneous_DoNotFilterLinkerDiagnostics --configuration debug output:
    error: 'miscellaneous_donotfilterlinkerdiagnostics': package 'miscellaneous_donotfilterlinkerdiagnostics' is using Swift tools version 5.11.0 but the installed version is 5.10.0
    "Test Case '-[BuildTests.BuildSystemDelegateTests testDoNotFilterLinkerDiagnostics]' failed (5.244 seconds).Test Suite 'BuildSystemDelegateTests' failed at 2024-01-24 18:48:49.325.

Right now we end up with this output on relink:

```
/Users/neonacho/Projects/public/swift-package-manager/.build/arm64-apple-macosx/debug/swift-bootstrap: replacing existing signature
```

This change specifically filters any output from `codesign` commands
which haven't failed and we aren't in verbose mode.

This should eventually be possible at the command level, but for the
time being this allows us to avoid shipping SwiftPM with this messy
output.

rdar://121529656

(cherry picked from commit e930796)
@neonichu neonichu force-pushed the filter-replacing-existing-signature-5.10 branch from f4a59b9 to 0248a64 Compare January 24, 2024 22:09
@neonichu
Copy link
Contributor Author

@swift-ci please test

@neonichu
Copy link
Contributor Author

@swift-ci please test windows

1 similar comment
@neonichu
Copy link
Contributor Author

@swift-ci please test windows

@MaxDesiatov MaxDesiatov changed the title Filter codesign messages [5.10] Filter codesign messages Jan 25, 2024
@MaxDesiatov MaxDesiatov added bug swift build Changes impacting `swift build` build system Changes to interactions with build systems labels Jan 25, 2024
@MaxDesiatov MaxDesiatov requested a review from bnbarham January 25, 2024 12:34
@neonichu
Copy link
Contributor Author

  • Explanation:

SwiftPM is code signing any binaries it produces on macOS in 5.10. Whenever a binary get relinked and resigned during incremental builds, it verbatim emits informational diagnostics to the log, which should only happen in verbose mode. Especially in projects which multiple binaries, this can make the log difficult to follow and may lead to confusion of users.

  • Scope: Any users on macOS will see this issue.
  • Risk: In theory, this change could lead to other diagnostics not being emitted, but the change is scoped to only code signing tasks, so the risk for this is very low.
  • Testing: Some new tests for SwiftPM's logging were added as part of this.
  • Reviewer: @MaxDesiatov
  • Main branch PR: Filter codesign messages #7285

@shahmishal shahmishal merged commit 4222b0f into release/5.10 Jan 26, 2024
@shahmishal shahmishal deleted the filter-replacing-existing-signature-5.10 branch January 26, 2024 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug build system Changes to interactions with build systems swift build Changes impacting `swift build` swift 5.10 This PR targets the 5.10 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants