Skip to content

Commit fe611d6

Browse files
committed
[Support] Use all_read | all_write for createTemporaryFile (llvm#83360)
In a04879c, dsymutil switched from using TempFile to createTemporaryFile. This caused a regression because the two use different permissions: - TempFile opens the file as all_read | all_write - createTemporaryFile opens the file as owner_read | owner_write The latter turns out to be problematic for dsymutil because it either promotes the temporary to a proper output file, or it would pass it to `lipo` to create a universal binary and `lipo` preserves the permissions of the input files. Either way, this caused issues when the build system was run as a different user than the one ingesting the resulting binaries. I did some version control archeology and I couldn't find evidence that these permissions were chosen purposely. Both could be considered reasonable default. This patch changes the permissions to `all read | all write` to make the two consistent and match the one currently used by the higher level abstraction (TempFile). rdar://123722848 (cherry picked from commit 310ed33)
1 parent 718808e commit fe611d6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Support/Path.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ createTemporaryFile(const Twine &Model, int &ResultFD,
850850
"Model must be a simple filename.");
851851
// Use P.begin() so that createUniqueEntity doesn't need to recreate Storage.
852852
return createUniqueEntity(P.begin(), ResultFD, ResultPath, true, Type, Flags,
853-
owner_read | owner_write);
853+
all_read | all_write);
854854
}
855855

856856
static std::error_code

0 commit comments

Comments
 (0)