Skip to content

Commit 79c70b1

Browse files
authored
Fixes ThreadSanitizer data access races between the BuildOperationBuildSystemDelegateHandler.commandProcessFinished() and BuildOperationBuildSystemDelegateHandler.commandProcessHadOutput() methods. (#4223)
The issue is that in one case there is access to `nonSwiftMessageBuffers` from outside the `org.swift.swiftpm.build-delegate` serial queue. These tests were failing with thread sanitizer enabled, and now they're passing: BuildToolTests.testXcodeBuildSystemDefaultSettings BuildToolTests.testXcodeBuildSystemOverrides TestToolTests.testEnableDisableTestability MiscellaneousTestCase.testExternalDependencyEdges1 MiscellaneousTestCase.testExternalDependencyEdges2 MiscellaneousTestCase.testPkgConfigCFamilyTargets ModuleMapsTestCase.testDirectDependency ModuleMapsTestCase.testTransitiveDependency PluginTests.testUseOfVendedBinaryTool
1 parent 0e804ed commit 79c70b1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/Build/BuildOperationBuildSystemDelegateHandler.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,8 @@ final class BuildOperationBuildSystemDelegateHandler: LLBuildBuildSystemDelegate
579579
process: ProcessHandle,
580580
result: CommandExtendedResult
581581
) {
582-
if let buffer = self.nonSwiftMessageBuffers[command.name] {
583-
queue.async {
582+
queue.async {
583+
if let buffer = self.nonSwiftMessageBuffers[command.name] {
584584
self.progressAnimation.clear()
585585
self.outputStream <<< buffer
586586
self.outputStream.flush()

0 commit comments

Comments
 (0)