Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-8707] Write out swiftdeps files atomically #51219

Closed
belkadan opened this issue Sep 6, 2018 · 4 comments
Closed

[SR-8707] Write out swiftdeps files atomically #51219

belkadan opened this issue Sep 6, 2018 · 4 comments
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

Comments

@belkadan
Copy link
Contributor

belkadan commented Sep 6, 2018

Previous ID SR-8707
Radar None
Original Reporter @belkadan
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, StarterBug
Assignee owenvoorhees (JIRA)
Priority Medium

md5: 6b7e2eb4edaa4e50a98a8a6530b3e380

relates to:

  • SR-8706 Fix up parseDependencyFile to not crash on invalid YAML

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 the ReferenceDependenciesEmitter::openFile helper completely.

[split off from rdar://problem/25095498, which is mostly covered by SR-8706]

@swift-ci
Copy link
Collaborator

swift-ci commented Oct 5, 2018

Comment by Owen Voorhees (JIRA)

I'd like to give this a try if no one is already working on it

@belkadan
Copy link
Contributor Author

belkadan commented Oct 5, 2018

Go for it! I won't be around these next few weeks, but graydon (JIRA User) or @harlanhaskins can probably help out with questions you have here.

@swift-ci
Copy link
Collaborator

Comment by Owen Voorhees (JIRA)

Change merged in https://github.com/apple/swift/pull/19752 , marking as resolved

@belkadan
Copy link
Contributor Author

Thanks, Owen!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

2 participants