swiftlang / swift-foundation

The Foundation project
Apache License 2.0
2.4k stars 160 forks source link

Don't fail `createDirectory` if directory is created concurrently by another process #1021

Closed ahoppen closed 1 week ago

ahoppen commented 2 weeks ago

The recursive directory might have been created concurrently by another process between the check for fileExists and createDirectory(atPath: parent, …), causing createDirectory to fail even though we would have had the expected result.

Ironically, I found this issue as a nondeterministic failure in Swift CI while fixing the same bug in swift-tools-support-core: https://github.com/swiftlang/swift-tools-support-core/pull/490

ahoppen commented 2 weeks ago

@swift-ci Please test

ahoppen commented 1 week ago

Addressed this issue in https://github.com/swiftlang/swift-foundation/pull/1033.