This is an archive of the discontinued LLVM Phabricator instance.

Changed createTemporaryFile without FD to actually create a file.
ClosedPublic

Authored by ilya-biryukov on Aug 17 2017, 5:43 AM.

Details

Summary

This commit changes semantics of createUniqueFile and
createTemporaryFile variants that do not return file descriptors.
Previously they only checked if files exist, therefore being subject
to race conditions. Now they will create an empty file to avoid them.

Functions that do not create a file are now called
getPotentiallyUniqueTempFileName and getPotentiallyUniqueFileName.

Event Timeline

ilya-biryukov created this revision.Aug 17 2017, 5:43 AM
ilya-biryukov added a comment.EditedAug 17 2017, 5:45 AM

One test in clang repo breaks after this change, relevant fix is here: https://reviews.llvm.org/D36828

klimek edited edge metadata.Sep 25 2017, 7:14 AM

Is this still pending review?

Is this still pending review?

Yes.

klimek accepted this revision.Nov 7 2017, 2:42 AM

Looks good. Sorry for the delay in review.

This revision is now accepted and ready to land.Nov 7 2017, 2:42 AM

Looks good. Sorry for the delay in review.

No problem. Will make sure it still works and land it.

Rafael made some changes to have dsymutil use the new TempFile class in r318534 so I think it's no longer relevant there. Is this used anywhere else?

Rafael made some changes to have dsymutil use the new TempFile class in r318534 so I think it's no longer relevant there. Is this used anywhere else?

I haven't looked into that yet. Will let you know when I get to it. There was one more usage in ToolingTest.cpp, D36828 fixes it.
Good to know that dsymutil does not require any changes.

espindola edited reviewers, added: espindola; removed: rafael.Mar 14 2018, 4:55 PM

Hey Ilya, is this blocked by something or has this been landed already?

Hey Ilya, is this blocked by something or has this been landed already?

Not yet landed, will have to rebase it and fix merge conflicts.
Will try to do that today.

  • Rebased onto head
This revision was automatically updated to reflect the committed changes.
dstenb added a subscriber: dstenb.Apr 11 2018, 10:04 AM

Hi! We have encountered a regression where clang-tidy leaves behind temporary files after this change. I wrote a PR for that: https://bugs.llvm.org/show_bug.cgi?id=37091.