[PATCH] D68193: In openFileForRead don't cache erroneous entries if the error relates to them being directories. Add tests.
Alex Lorenz via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 8 12:12:43 PDT 2019
arphaman requested changes to this revision.
arphaman added a comment.
This revision now requires changes to proceed.
@kousikk Thanks, I understand your patch better now. It makes more sense for sure.
When we're opening the file we shouldn't `stat` before calling `open`, as there's a race condition introduced, where the value of the `stat` could change between the call between `stat` and `open` is performed. We've seen problems like this before, and it ends up in crashes and mismatch size errors as Clang is getting invalid size from the stat if the file is modified in that time. We should still call `open` + `fstat` like we used. So I would recommend not changing the `createFileEntry` function to take in a stat, and do the fstat after opening the file like it used to.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68193/new/
https://reviews.llvm.org/D68193
More information about the cfe-commits
mailing list