[PATCH] D93881: [llvm-objcopy] preserve file ownership when overwritten
Jordan Rupprecht via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 3 16:31:37 PST 2021
rupprecht added inline comments.
================
Comment at: llvm/lib/Support/FileOutputBuffer.cpp:131
Expected<fs::TempFile> FileOrErr =
fs::TempFile::create(Path + ".tmp%%%%%%%", Mode);
if (!FileOrErr)
----------------
jhenderson wrote:
> Is there a way we could improve this API to create the temporary file with the right UID and GID in the first place? That seems like a better idea to me than having to do something post creation.
>
> A thought to consider (I don't know what the desirable behaviour is here): what happens if a user were to Ctrl-C (or the program otherwise terminated unexpectedly) after the TempFile creation, before the ownership was updated? Would the temp file be in a desirable state?
Calling `setfsuid` was suggested at one point, but that isn't a portable solution. Something like that would be the ideal fix IMO.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93881/new/
https://reviews.llvm.org/D93881
More information about the llvm-commits
mailing list