[SR-8707] Write out swiftdeps files atomically #51219
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
good first issue
Good for newcomers
Additional Detail from JIRA
md5: 6b7e2eb4edaa4e50a98a8a6530b3e380
relates to:
Issue Description:
ReferenceDependenciesEmitter::emit
in ReferenceDependencies.cpp writes the output directly to the specified path, instead of writing to a temporary file and then "atomically" renaming it into place. This can lead to truncated files if the compiler job is killed at exactly the wrong time.Since
ReferenceDependenciesEmitter::emit
was implemented, a helper function was added to do exactly this kind of atomic rename:atomicallyWritingToFile
in swift/Basic/FileSystem.h. This can replace theReferenceDependenciesEmitter::openFile
helper completely.[split off from rdar://problem/25095498, which is mostly covered by SR-8706]
The text was updated successfully, but these errors were encountered: