[PATCH] D111875: [Support] [Windows] Manually clean up temp files on network shares
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 18 13:24:34 PDT 2021
mstorsjo added a comment.
In D111875#3071269 <https://reviews.llvm.org/D111875#3071269>, @rnk wrote:
> Here's an idea to try to make this a bit cleaner. Maybe `setDeleteDisposition` should return an error code when the path is on a network drive. That return value would be propagated back up to the caller who sets `OF_Delete`. In this case, that is `TempFile::create`. At that point, TempFile can retry temporary file creation without `OF_Delete`.
Hmm... It would indeed be cleaner in the sense that `setDeleteDisposition` doesn't lie about whether it succeeded or not - but that would require using a specific error code for it that the caller would look for (so we don't retry without the flag for any random error) and hope that we don't map other real system errors to that error code.
> The downside to this is that we will create the file, set the disposition (fails), delete the file, and recreate it again without `OF_Delete`.
Yeah, that's in practice probably a much bigger overhead than just calling `setDeleteDisposition` one more time.
> To improve on that, we could have some kind of `canSetDeleteDisposition` portable API, which would feed into the choice to set the `OF_Delete` flag.
Hmm, I guess that could work too. It requires mimicing the logic/checks from `setDeleteDisposition` - or maybe we could remove the logic from there altogether? (I think it should be kept though, so that `OF_Delete` behaves roughly as documented even in those cases, though.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111875/new/
https://reviews.llvm.org/D111875
More information about the llvm-commits
mailing list