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
for two directories that share a common parent (e.g. /a/b/ and /a/c) and the parent does not exist, it can fail spuriously with EEXIST using corelibs-foundation. On macOS Foundation it does not fail this way. This caused a test failure in sourcekit-lsp when running tests in parallel that we had to workaround[0].
Reproducer (you may need to run it a few times):
import Foundation
letbase=URL(fileURLWithPath:"/tmp/createDirectoryTest", isDirectory: true)letfm=FileManager.default
_ =try? fm.removeItem(at: base)print("serial")
for i in 0..<2{try! fm.createDirectory(at: base.appendingPathComponent("\(i)"), withIntermediateDirectories: true)}try! fm.removeItem(at: base)print("-> OK")print("parallel")
for _ in 0..<10{DispatchQueue.concurrentPerform(iterations:2){ i intry! fm.createDirectory(at: base.appendingPathComponent("\(i)"), withIntermediateDirectories: true)}try! fm.removeItem(at: base)}print("-> OK")
$ swiftc createDirectoryTest.swift && ./createDirectoryTest
serial
-> OK
parallel
Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=516 "A file with the same name already exists.": file createDirectoryTest.swift, line 18
<EXPR>:0: error: CodeActionTests.testSemanticRefactorLocalRenameResult : threw error "Error Domain=NSCocoaErrorDomain Code=516 "A file with the same name already exists.""
The text was updated successfully, but these errors were encountered:
Environment
swift-DEVELOPMENT-SNAPSHOT-2020-04-06-a
Additional Detail from JIRA
md5: de0166218244431d1d35fb688f5d0f19
relates to:
FileManager
temporary directory creation not thread-safe on LinuxIssue Description:
If you concurrently call
for two directories that share a common parent (e.g.
/a/b/
and/a/c
) and the parent does not exist, it can fail spuriously withEEXIST
using corelibs-foundation. On macOS Foundation it does not fail this way. This caused a test failure in sourcekit-lsp when running tests in parallel that we had to workaround[0].Reproducer (you may need to run it a few times):
[0] https://ci.swift.org/job/swift-PR-Linux-smoke-test/21501/ rdar://61545973
The text was updated successfully, but these errors were encountered: