Skip to content

Commit b5618cb

Browse files
[vs17.14] Merge v17.14.28 into vs17.14 (#12650)
Merging tag v17.14.28 into vs17.14 branch
2 parents c9a5370 + f89a133 commit b5618cb

File tree

2 files changed

+10
-30
lines changed

2 files changed

+10
-30
lines changed

eng/Versions.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
33
<Project>
44
<PropertyGroup>
5-
<VersionPrefix>17.14.27</VersionPrefix>
5+
<VersionPrefix>17.14.28</VersionPrefix>
66
<DotNetFinalVersionKind>release</DotNetFinalVersionKind>
77
<PackageValidationBaselineVersion>17.13.9</PackageValidationBaselineVersion>
88
<AssemblyVersion>15.1.0.0</AssemblyVersion>
99
<PreReleaseVersionLabel>servicing</PreReleaseVersionLabel>
1010

11-
<!-- differentiate experimental insertions to avoid package id conflicts,
11+
<!-- differentiate experimental insertions to avoid package id conflicts,
1212
it has to be alphabetically after "preview" to avoid downgrade errors in VS -->
1313
<PreReleaseVersionLabel Condition="'$(IsExperimental)' == 'true'">test</PreReleaseVersionLabel>
1414

src/Shared/TempFileUtilities.cs

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ internal static partial class FileUtilities
1818
{
1919
// For the current user, these correspond to read, write, and execute permissions.
2020
// Lower order bits correspond to the same for "group" or "other" users.
21-
private const int userRWX = 0x100 | 0x80 | 0x40;
2221
private static string tempFileDirectory = null;
2322
private const string msbuildTempFolderPrefix = "MSBuildTemp";
2423

@@ -38,40 +37,21 @@ internal static void ClearTempFileDirectory()
3837
// For all native calls, directly check their return values to prevent bad actors from getting in between checking if a directory exists and returning it.
3938
private static string CreateFolderUnderTemp()
4039
{
41-
// On windows Username with Unicode chars can give issues, so we dont append username to the temp folder name.
42-
string msbuildTempFolder = NativeMethodsShared.IsWindows ?
43-
msbuildTempFolderPrefix :
44-
msbuildTempFolderPrefix + Environment.UserName;
40+
string path = null;
4541

46-
string basePath = Path.Combine(Path.GetTempPath(), msbuildTempFolder);
47-
48-
if (NativeMethodsShared.IsLinux && NativeMethodsShared.mkdir(basePath, userRWX) != 0)
42+
if (NativeMethodsShared.IsLinux)
4943
{
50-
if (NativeMethodsShared.chmod(basePath, userRWX) == 0)
51-
{
52-
// Current user owns this file; we can read and write to it. It is reasonable here to assume it was created properly by MSBuild and can be used
53-
// for temporary files.
54-
}
55-
else
56-
{
57-
// Another user created a folder pretending to be us! Find a folder we can actually use.
58-
int extraBits = 0;
59-
string pathToCheck = basePath + extraBits;
60-
while (NativeMethodsShared.mkdir(pathToCheck, userRWX) != 0 && NativeMethodsShared.chmod(pathToCheck, userRWX) != 0)
61-
{
62-
extraBits++;
63-
pathToCheck = basePath + extraBits;
64-
}
65-
66-
basePath = pathToCheck;
67-
}
44+
#if NET // always true, Linux implies NET
45+
path = Directory.CreateTempSubdirectory(msbuildTempFolderPrefix).FullName;
46+
#endif
6847
}
6948
else
7049
{
71-
Directory.CreateDirectory(basePath);
50+
path = Path.Combine(Path.GetTempPath(), msbuildTempFolderPrefix);
51+
Directory.CreateDirectory(path);
7252
}
7353

74-
return FileUtilities.EnsureTrailingSlash(basePath);
54+
return FileUtilities.EnsureTrailingSlash(path);
7555
}
7656

7757
/// <summary>

0 commit comments

Comments
 (0)