You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gracefully fail workspace state loading when duplicate entries found (#3974)
motivation: some older versions of SwiftPM wrote duplicate entries into workspace-state.json which can cause a crash due to use of Dictionary::uniquingKeysWith
changes:
* do not use Dictionary::uniquingKeysWith for non-santized input such as workspace state
* add tests
rdar://86857825
self.artifactMap =try artifactsByPackagePath.mapValues{ artifacts in
125
+
// rdar://86857825 do not use Dictionary(uniqueKeysWithValues:) as it can crash the process when input is incorrect such as in older versions of SwiftPM
126
+
varmap=[String: ManagedArtifact]()
127
+
forartifactin artifacts {
128
+
ifmap[artifact.targetName]!=nil{
129
+
throwStringError("binary artifact for '\(artifact.targetName)' already exists in managed artifacts")
// rdar://86857825 do not use Dictionary(uniqueKeysWithValues:) as it can crash the process when input is incorrect such as in older versions of SwiftPM
0 commit comments