From d73e0787eb302cfeae391654a8c1c31114263c09 Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Tue, 26 Jul 2022 15:17:18 -0400 Subject: [PATCH] Remove unused patches These patch files are never applied. Remove them from repo. --- arcade-no-apphost.patch | 36 -- ...ine-api-use-work-tree-with-git-apply.patch | 27 -- fsharp-no-apphost.patch | 21 - fsharp-use-work-tree-with-git-apply.patch | 11 - installer-12516-portablerid.patch | 23 - msbuild-no-systemconfiguration.patch | 46 -- msbuild-no-systemsecurity.patch | 12 - roslyn-57003-mono-named-mutex.patch | 453 ------------------ roslyn-analyzers-no-apphost.patch | 10 - roslyn-no-apphost.patch | 10 - runtime-66594-s390x-debuginfo.patch | 29 -- runtime-arm64-lld-fix.patch | 18 - runtime-fedora-37-rid.patch | 84 ---- runtime-mono-remove-ilstrip.patch | 33 -- sdk-22373-portablerid.patch | 22 - sdk-telemetry-optout.patch | 18 - vstest-use-work-tree-with-git-apply.patch | 33 -- ...f-tasks-use-work-tree-with-git-apply.patch | 11 - 18 files changed, 897 deletions(-) delete mode 100644 arcade-no-apphost.patch delete mode 100644 command-line-api-use-work-tree-with-git-apply.patch delete mode 100644 fsharp-no-apphost.patch delete mode 100644 fsharp-use-work-tree-with-git-apply.patch delete mode 100644 installer-12516-portablerid.patch delete mode 100644 msbuild-no-systemconfiguration.patch delete mode 100644 msbuild-no-systemsecurity.patch delete mode 100644 roslyn-57003-mono-named-mutex.patch delete mode 100644 roslyn-analyzers-no-apphost.patch delete mode 100644 roslyn-no-apphost.patch delete mode 100644 runtime-66594-s390x-debuginfo.patch delete mode 100644 runtime-arm64-lld-fix.patch delete mode 100644 runtime-fedora-37-rid.patch delete mode 100644 runtime-mono-remove-ilstrip.patch delete mode 100644 sdk-22373-portablerid.patch delete mode 100644 sdk-telemetry-optout.patch delete mode 100644 vstest-use-work-tree-with-git-apply.patch delete mode 100644 xliff-tasks-use-work-tree-with-git-apply.patch diff --git a/arcade-no-apphost.patch b/arcade-no-apphost.patch deleted file mode 100644 index cec03a1..0000000 --- a/arcade-no-apphost.patch +++ /dev/null @@ -1,36 +0,0 @@ -Index: a/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj -=================================================================== ---- a/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj -+++ b/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj -@@ -5,6 +5,7 @@ - netcoreapp3.1 - latest - true -+ false - - - -Index: a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj -=================================================================== ---- a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj -+++ b/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj -@@ -9,6 +9,7 @@ - dotnet-swaggergen - false - true -+ false - - - -Index: a/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj -=================================================================== ---- a/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj -+++ b/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj -@@ -11,6 +11,7 @@ - 2.5.1 - true - Major -+ false - - - diff --git a/command-line-api-use-work-tree-with-git-apply.patch b/command-line-api-use-work-tree-with-git-apply.patch deleted file mode 100644 index 552d59d..0000000 --- a/command-line-api-use-work-tree-with-git-apply.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 7a752928ed3588246c4b296feb6cf4946f1b29b7 Mon Sep 17 00:00:00 2001 -From: Omair Majid -Date: Thu, 9 Sep 2021 12:11:39 -0400 -Subject: [PATCH] [ArPow] Use --work-tree with git apply - -This makes things work better in a source-tarball build, where there may -be a .git directory but it's for a different repo than command-line-api. ---- - eng/SourceBuild.props | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props -index 6cc85018..5e223747 100644 ---- a/eng/SourceBuild.props -+++ b/eng/SourceBuild.props -@@ -15,7 +15,7 @@ - - - - --- -2.31.1 - diff --git a/fsharp-no-apphost.patch b/fsharp-no-apphost.patch deleted file mode 100644 index 1534888..0000000 --- a/fsharp-no-apphost.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/tests/benchmarks/MicroPerf/MicroPerf.fsproj -+++ b/tests/benchmarks/MicroPerf/MicroPerf.fsproj -@@ -9,6 +9,7 @@ - $(OtherFlags) --nowarn:57 - $(OtherFlags) --langversion:preview - $(OtherFlags) --define:PREVIEW -+ false - - - - $(OtherFlags) --nowarn:1204 - - diff --git a/fsharp-use-work-tree-with-git-apply.patch b/fsharp-use-work-tree-with-git-apply.patch deleted file mode 100644 index 810cf67..0000000 --- a/fsharp-use-work-tree-with-git-apply.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/eng/SourceBuild.props -+++ b/eng/SourceBuild.props -@@ -15,7 +15,7 @@ - - - - diff --git a/installer-12516-portablerid.patch b/installer-12516-portablerid.patch deleted file mode 100644 index 4cb4ab6..0000000 --- a/installer-12516-portablerid.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 892222071f73062f969f4f6ed1df8f759b9327b7 Mon Sep 17 00:00:00 2001 -From: Tom Deseyn -Date: Wed, 3 Nov 2021 15:12:59 +0100 -Subject: [PATCH] GetRuntimeInformation.targets: determine - PortableProductMonikerRid based on HostOSName and Architecture. - ---- - src/redist/targets/GetRuntimeInformation.targets | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/redist/targets/GetRuntimeInformation.targets b/src/redist/targets/GetRuntimeInformation.targets -index 5133c3a3841..01f704c7d8e 100644 ---- a/src/redist/targets/GetRuntimeInformation.targets -+++ b/src/redist/targets/GetRuntimeInformation.targets -@@ -28,6 +28,8 @@ - '$(Rid)' == 'linux-musl-x64' ">$(Rid) - $(OSName)-$(Architecture) - -+ $(HostOSName)-$(Architecture) -+ - dotnet-sdk-internal$(PgoTerm) - dotnet-sdk$(PgoTerm) - diff --git a/msbuild-no-systemconfiguration.patch b/msbuild-no-systemconfiguration.patch deleted file mode 100644 index 537470d..0000000 --- a/msbuild-no-systemconfiguration.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- a/src/Build/Definition/ProjectCollection.cs -+++ b/src/Build/Definition/ProjectCollection.cs -@@ -1754,7 +1754,11 @@ namespace Microsoft.Build.Evaluation - #if FEATURE_WIN32_REGISTRY - ToolsetRegistryReader registryReader = null, - #endif -+#if FEATURE_SYSTEM_CONFIGURATION - ToolsetConfigurationReader configReader = null -+#else -+ object configReader = null -+#endif - ) - { - _toolsets = new Dictionary(StringComparer.OrdinalIgnoreCase); ---- a/src/Build/Definition/ToolsetReader.cs -+++ b/src/Build/Definition/ToolsetReader.cs -@@ -101,7 +101,11 @@ namespace Microsoft.Build.Evaluation - #if FEATURE_WIN32_REGISTRY - ToolsetRegistryReader registryReader, - #endif -+#if FEATURE_SYSTEM_CONFIGURATION - ToolsetConfigurationReader configurationReader, -+#else -+ object _configurationReader, -+#endif - PropertyDictionary environmentProperties, - PropertyDictionary globalProperties, - ToolsetDefinitionLocations locations -@@ -120,6 +124,7 @@ namespace Microsoft.Build.Evaluation - - if ((locations & ToolsetDefinitionLocations.ConfigurationFile) == ToolsetDefinitionLocations.ConfigurationFile) - { -+#if FEATURE_SYSTEM_CONFIGURATION - if (configurationReader == null) - { - configurationReader = new ToolsetConfigurationReader(environmentProperties, globalProperties); -@@ -129,6 +134,9 @@ namespace Microsoft.Build.Evaluation - defaultToolsVersionFromConfiguration = configurationReader.ReadToolsets(toolsets, globalProperties, - initialProperties, true /* accumulate properties */, out overrideTasksPathFromConfiguration, - out defaultOverrideToolsVersionFromConfiguration); -+#else -+ throw new InvalidOperationException("ToolsetDefinitionLocations.ConfigurationFile not supported"); -+#endif - } - - string defaultToolsVersionFromRegistry = null; diff --git a/msbuild-no-systemsecurity.patch b/msbuild-no-systemsecurity.patch deleted file mode 100644 index dcf6809..0000000 --- a/msbuild-no-systemsecurity.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/src/Shared/ExceptionHandling.cs -+++ b/src/Shared/ExceptionHandling.cs -@@ -153,7 +153,9 @@ namespace Microsoft.Build.Shared - internal static bool IsXmlException(Exception e) - { - return e is XmlException -+#if FEATURE_SECURITY_PERMISSIONS - || e is XmlSyntaxException -+#endif - || e is XmlSchemaException - || e is UriFormatException; // XmlTextReader for example uses this under the covers - } diff --git a/roslyn-57003-mono-named-mutex.patch b/roslyn-57003-mono-named-mutex.patch deleted file mode 100644 index c264bff..0000000 --- a/roslyn-57003-mono-named-mutex.patch +++ /dev/null @@ -1,453 +0,0 @@ -Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs -=================================================================== ---- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs -+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs -@@ -31,5 +31,24 @@ namespace Roslyn.Utilities - } - } - } -+ /// -+ /// Are we running on .NET 5 or later using the Mono runtime? -+ /// Will also return true when running on Mono itself; if necessary -+ /// we can use IsRunningOnMono to distinguish. -+ /// -+ public static bool IsUsingMonoRuntime -+ { -+ get -+ { -+ try -+ { -+ return !(Type.GetType("Mono.RuntimeStructs", throwOnError: false) is null); -+ } -+ catch -+ { -+ return false; -+ } -+ } -+ } - } - } -Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs -=================================================================== ---- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs -+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs -@@ -79,7 +79,7 @@ namespace Microsoft.CodeAnalysis.Compile - // to connect. When it fails it should fall back to in-proc - // compilation. - bool holdsMutex; -- using (var serverMutex = new Mutex(initiallyOwned: true, -+ using (var serverMutex = BuildServerConnection.OpenOrCreateMutex( - name: BuildServerConnection.GetServerMutexName(_pipeName), - createdNew: out holdsMutex)) - { -Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs -=================================================================== ---- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs -+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs -@@ -103,7 +103,7 @@ class Hello - var mutexName = BuildServerConnection.GetServerMutexName(pipeName); - - bool holdsMutex; -- using (var mutex = new Mutex(initiallyOwned: true, -+ using (var mutex = BuildServerConnection.OpenOrCreateMutex( - name: mutexName, - createdNew: out holdsMutex)) - { -@@ -119,7 +119,7 @@ class Hello - } - finally - { -- mutex.ReleaseMutex(); -+ mutex.Dispose(); - } - } - } -Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs -=================================================================== ---- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs -+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs -@@ -304,7 +304,7 @@ End Module") - var newTempDir = _tempDirectory.CreateDirectory(new string('a', 100 - _tempDirectory.Path.Length)); - await ApplyEnvironmentVariables( - new[] { new KeyValuePair("TMPDIR", newTempDir.Path) }, -- async () => -+ async () => await Task.Run(async () => - { - using var serverData = await ServerUtil.CreateServer(_logger); - var result = RunCommandLineCompiler( -@@ -317,7 +317,7 @@ End Module") - - var listener = await serverData.Complete(); - Assert.Equal(CompletionData.RequestCompleted, listener.CompletionDataList.Single()); -- }); -+ })); - } - - [Fact] -Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs -=================================================================== ---- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs -+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs -@@ -101,7 +101,7 @@ namespace Microsoft.CodeAnalysis.Compile - - var thread = new Thread(() => - { -- using (var mutex = new Mutex(initiallyOwned: true, name: mutexName, createdNew: out created)) -+ using (var mutex = BuildServerConnection.OpenOrCreateMutex(name: mutexName, createdNew: out created)) - using (var stream = NamedPipeUtil.CreateServer(pipeName)) - { - readyMre.Set(); -@@ -112,7 +112,7 @@ namespace Microsoft.CodeAnalysis.Compile - stream.Close(); - - doneMre.WaitOne(); -- mutex.ReleaseMutex(); -+ mutex.Dispose(); - } - }); - -@@ -153,7 +153,7 @@ namespace Microsoft.CodeAnalysis.Compile - { - using (var stream = NamedPipeUtil.CreateServer(pipeName)) - { -- var mutex = new Mutex(initiallyOwned: true, name: mutexName, createdNew: out created); -+ var mutex = BuildServerConnection.OpenOrCreateMutex(name: mutexName, createdNew: out created); - readyMre.Set(); - - stream.WaitForConnection(); -@@ -161,7 +161,6 @@ namespace Microsoft.CodeAnalysis.Compile - - // Client is waiting for a response. Close the mutex now. Then close the connection - // so the client gets an error. -- mutex.ReleaseMutex(); - mutex.Dispose(); - stream.Close(); - -Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Shared/BuildServerConnection.cs -=================================================================== ---- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Shared/BuildServerConnection.cs -+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Shared/BuildServerConnection.cs -@@ -543,19 +543,10 @@ namespace Microsoft.CodeAnalysis.Command - { - try - { -- if (PlatformInformation.IsRunningOnMono) -+ if (PlatformInformation.IsUsingMonoRuntime) - { -- IServerMutex? mutex = null; -- bool createdNew = false; -- try -- { -- mutex = new ServerFileMutexPair(mutexName, false, out createdNew); -- return !createdNew; -- } -- finally -- { -- mutex?.Dispose(); -- } -+ using var mutex = new ServerFileMutex(mutexName); -+ return !mutex.CouldLock(); - } - else - { -@@ -572,9 +563,11 @@ namespace Microsoft.CodeAnalysis.Command - - internal static IServerMutex OpenOrCreateMutex(string name, out bool createdNew) - { -- if (PlatformInformation.IsRunningOnMono) -+ if (PlatformInformation.IsUsingMonoRuntime) - { -- return new ServerFileMutexPair(name, initiallyOwned: true, out createdNew); -+ var mutex = new ServerFileMutex(name); -+ createdNew = mutex.TryLock(0); -+ return mutex; - } - else - { -@@ -648,19 +641,22 @@ namespace Microsoft.CodeAnalysis.Command - } - - /// -- /// An interprocess mutex abstraction based on OS advisory locking (FileStream.Lock/Unlock). -+ /// An interprocess mutex abstraction based on file sharing permission (FileShare.None). - /// If multiple processes running as the same user create FileMutex instances with the same name, - /// those instances will all point to the same file somewhere in a selected temporary directory. -- /// The TryLock method can be used to attempt to acquire the mutex, with Unlock or Dispose used to release. -+ /// The TryLock method can be used to attempt to acquire the mutex, with Dispose used to release. -+ /// The CouldLock method can be used to check whether an attempt to acquire the mutex would have -+ /// succeeded at the current time, without actually acquiring it. - /// Unlike Win32 named mutexes, there is no mechanism for detecting an abandoned mutex. The file - /// will simply revert to being unlocked but remain where it is. - /// -- internal sealed class FileMutex : IDisposable -+ internal sealed class ServerFileMutex : IServerMutex - { -- public readonly FileStream Stream; -+ public FileStream? Stream; - public readonly string FilePath; -+ public readonly string GuardPath; - -- public bool IsLocked { get; private set; } -+ public bool IsDisposed { get; private set; } - - internal static string GetMutexDirectory() - { -@@ -670,61 +666,176 @@ namespace Microsoft.CodeAnalysis.Command - return result; - } - -- public FileMutex(string name) -+ public ServerFileMutex(string name) - { -- FilePath = Path.Combine(GetMutexDirectory(), name); -- Stream = new FileStream(FilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); -+ var mutexDirectory = GetMutexDirectory(); -+ FilePath = Path.Combine(mutexDirectory, name); -+ GuardPath = Path.Combine(mutexDirectory, ".guard"); - } - -- public bool TryLock(int timeoutMs) -+ /// -+ /// Acquire the guard by opening the guard file with FileShare.None. The guard must only ever -+ /// be held for very brief amounts of time, so we can simply spin until it is acquired. The -+ /// guard must be released by disposing the FileStream returned from this routine. Note the -+ /// guard file is never deleted; this is a leak, but only of a single file. -+ /// -+ internal FileStream LockGuard() - { -- if (IsLocked) -- throw new InvalidOperationException("Lock already held"); -- -- var sw = Stopwatch.StartNew(); -- do -+ // We should be able to acquire the guard quickly. Limit the number of retries anyway -+ // by some arbitrary bound to avoid getting hung up in a possibly infinite loop. -+ for (var i = 0; i < 100; i++) - { - try - { -- Stream.Lock(0, 0); -- IsLocked = true; -- return true; -+ return new FileStream(GuardPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); - } - catch (IOException) - { -- // Lock currently held by someone else. -+ // Guard currently held by someone else. - // We want to sleep for a short period of time to ensure that other processes - // have an opportunity to finish their work and relinquish the lock. - // Spinning here (via Yield) would work but risks creating a priority - // inversion if the lock is held by a lower-priority process. - Thread.Sleep(1); - } -+ } -+ // Handle unexpected failure to acquire guard as error. -+ throw new InvalidOperationException("Unable to acquire guard"); -+ } -+ -+ /// -+ /// Attempt to acquire the lock by opening the lock file with FileShare.None. Sets "Stream" -+ /// and returns true if successful, returns false if the lock is already held by another -+ /// thread or process. Guard must be held when calling this routine. -+ /// -+ internal bool TryLockFile() -+ { -+ Debug.Assert(Stream is null); -+ FileStream? stream = null; -+ try -+ { -+ stream = new FileStream(FilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); -+ // On some targets, the file locking used to implement FileShare.None may not be -+ // atomic with opening/creating the file. This creates a race window when another -+ // thread holds the lock and is just about to unlock: we may be able to open the -+ // file here, then the other thread unlocks and deletes the file, and then we -+ // acquire the lock on our file handle - but the actual file is already deleted. -+ // To close this race, we verify that the file does in fact still exist now that -+ // we have successfull acquired the locked FileStream. (Note that this check is -+ // safe because we cannot race with an other attempt to create the file since we -+ // hold the guard, and after the FileStream constructor returned we can no race -+ // with file deletion because we hold the lock.) -+ if (!File.Exists(FilePath)) -+ { -+ // To simplify the logic, we treat this case as "unable to acquire the lock" -+ // because it we caught another process while it owned the lock and was just -+ // giving it up. If the caller retries, we'll likely acquire the lock then. -+ stream.Dispose(); -+ return false; -+ } -+ } -+ catch (Exception) -+ { -+ stream?.Dispose(); -+ return false; -+ } -+ Stream = stream; -+ return true; -+ } -+ -+ /// -+ /// Release the lock by deleting the lock file and disposing "Stream". -+ /// -+ internal void UnlockFile() -+ { -+ Debug.Assert(Stream is not null); -+ try -+ { -+ // Delete the lock file while the stream is not yet disposed -+ // and we therefore still hold the FileShare.None exclusion. -+ // There may still be a race with another thread attempting a -+ // TryLockFile in parallel, but that is safely handled there. -+ File.Delete(FilePath); -+ } -+ finally -+ { -+ Stream.Dispose(); -+ Stream = null; -+ } -+ } -+ -+ public bool TryLock(int timeoutMs) -+ { -+ if (IsDisposed) -+ throw new ObjectDisposedException("Mutex"); -+ if (Stream is not null) -+ throw new InvalidOperationException("Lock already held"); -+ -+ var sw = Stopwatch.StartNew(); -+ do -+ { -+ try -+ { -+ // Attempt to acquire lock while holding guard. -+ using var guard = LockGuard(); -+ if (TryLockFile()) -+ return true; -+ } - catch (Exception) - { -- // Something else went wrong. - return false; - } -+ -+ // See comment in LockGuard. -+ Thread.Sleep(1); - } while (sw.ElapsedMilliseconds < timeoutMs); - - return false; - } - -- public void Unlock() -+ public bool CouldLock() - { -- if (!IsLocked) -- return; -- Stream.Unlock(0, 0); -- IsLocked = false; -+ if (IsDisposed) -+ return false; -+ if (Stream is not null) -+ return false; -+ -+ try -+ { -+ // Attempt to acquire lock while holding guard, and if successful -+ // immediately unlock again while still holding guard. This ensures -+ // no other thread will spuriously observe the lock as held due to -+ // the lock attempt here. -+ using var guard = LockGuard(); -+ if (TryLockFile()) -+ { -+ UnlockFile(); -+ return true; -+ } -+ } -+ catch (Exception) -+ { -+ return false; -+ } -+ -+ return false; - } - - public void Dispose() - { -- var wasLocked = IsLocked; -- if (wasLocked) -- Unlock(); -- Stream.Dispose(); -- // We do not delete the lock file here because there is no reliable way to perform a -- // 'delete if no one has the file open' operation atomically on *nix. This is a leak. -+ if (IsDisposed) -+ return; -+ IsDisposed = true; -+ if (Stream is not null) -+ { -+ try -+ { -+ UnlockFile(); -+ } -+ catch (Exception) -+ { -+ } -+ } - } - } - -@@ -792,56 +903,4 @@ namespace Microsoft.CodeAnalysis.Command - } - } - } -- -- /// -- /// Approximates a named mutex with 'locked', 'unlocked' and 'abandoned' states. -- /// There is no reliable way to detect whether a mutex has been abandoned on some target platforms, -- /// so we use the AliveMutex to manually track whether the creator of a mutex is still running, -- /// while the HeldMutex represents the actual lock state of the mutex. -- /// -- internal sealed class ServerFileMutexPair : IServerMutex -- { -- public readonly FileMutex AliveMutex; -- public readonly FileMutex HeldMutex; -- -- public bool IsDisposed { get; private set; } -- -- public ServerFileMutexPair(string mutexName, bool initiallyOwned, out bool createdNew) -- { -- AliveMutex = new FileMutex(mutexName + "-alive"); -- HeldMutex = new FileMutex(mutexName + "-held"); -- createdNew = AliveMutex.TryLock(0); -- if (initiallyOwned && createdNew) -- { -- if (!TryLock(0)) -- throw new Exception("Failed to lock mutex after creating it"); -- } -- } -- -- public bool TryLock(int timeoutMs) -- { -- if (IsDisposed) -- throw new ObjectDisposedException("Mutex"); -- return HeldMutex.TryLock(timeoutMs); -- } -- -- public void Dispose() -- { -- if (IsDisposed) -- return; -- IsDisposed = true; -- -- try -- { -- HeldMutex.Unlock(); -- AliveMutex.Unlock(); -- } -- finally -- { -- AliveMutex.Dispose(); -- HeldMutex.Dispose(); -- } -- } -- } -- - } diff --git a/roslyn-analyzers-no-apphost.patch b/roslyn-analyzers-no-apphost.patch deleted file mode 100644 index c1fc3dd..0000000 --- a/roslyn-analyzers-no-apphost.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/src/Tools/ReleaseNotesUtil/ReleaseNotesUtil.csproj -+++ b/src/Tools/ReleaseNotesUtil/ReleaseNotesUtil.csproj -@@ -4,6 +4,7 @@ - netcoreapp3.1 - true - true -+ false - - - diff --git a/roslyn-no-apphost.patch b/roslyn-no-apphost.patch deleted file mode 100644 index f1767c7..0000000 --- a/roslyn-no-apphost.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/src/Workspaces/Remote/ServiceHub.CoreComponents/Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents.csproj -+++ b/src/Workspaces/Remote/ServiceHub.CoreComponents/Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents.csproj -@@ -5,6 +5,7 @@ - Exe - netcoreapp3.1 - -+ false - false - - diff --git a/runtime-66594-s390x-debuginfo.patch b/runtime-66594-s390x-debuginfo.patch deleted file mode 100644 index 5637645..0000000 --- a/runtime-66594-s390x-debuginfo.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff --git a/src/mono/mono.proj b/src/mono/mono.proj -index fb98ffc1896..d6a0c9a8ec2 100644 ---- a/src/mono/mono.proj -+++ b/src/mono/mono.proj -@@ -519,17 +519,17 @@ - - <_Objcopy Condition="'$(_ObjcopyFound)' != '0'">objcopy - -- -+ - - - - -- -- -- -- -- -- -+ -+ -+ -+ -+ -+ - - - diff --git a/runtime-arm64-lld-fix.patch b/runtime-arm64-lld-fix.patch deleted file mode 100644 index db6f520..0000000 --- a/runtime-arm64-lld-fix.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/eng/native/init-compiler.sh b/eng/native/init-compiler.sh -index 567d18da474..927b3071e92 100755 ---- a/eng/native/init-compiler.sh -+++ b/eng/native/init-compiler.sh -@@ -108,11 +108,8 @@ - fi - - if [[ "$compiler" == "clang" ]]; then -- if command -v "lld$desired_version" > /dev/null; then -- # Only lld version >= 9 can be considered stable -- if [[ "$majorVersion" -ge 9 ]]; then -- LDFLAGS="-fuse-ld=lld" -- fi -+ if "$CC" -fuse-ld=lld -Wl,--version >/dev/null 2>&1; then -+ LDFLAGS="-fuse-ld=lld" - fi - fi - diff --git a/runtime-fedora-37-rid.patch b/runtime-fedora-37-rid.patch deleted file mode 100644 index 720fdcb..0000000 --- a/runtime-fedora-37-rid.patch +++ /dev/null @@ -1,84 +0,0 @@ -diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json -index bf6dfc3c1a1..1de4979b8ee 100644 ---- a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json -+++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json -@@ -3029,6 +3029,38 @@ - "any", - "base" - ], -+ "fedora.37": [ -+ "fedora.37", -+ "fedora", -+ "linux", -+ "unix", -+ "any", -+ "base" -+ ], -+ "fedora.37-arm64": [ -+ "fedora.37-arm64", -+ "fedora.37", -+ "fedora-arm64", -+ "fedora", -+ "linux-arm64", -+ "linux", -+ "unix-arm64", -+ "unix", -+ "any", -+ "base" -+ ], -+ "fedora.37-x64": [ -+ "fedora.37-x64", -+ "fedora.37", -+ "fedora-x64", -+ "fedora", -+ "linux-x64", -+ "linux", -+ "unix-x64", -+ "unix", -+ "any", -+ "base" -+ ], - "freebsd": [ - "freebsd", - "unix", -diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json -index 2e6ec616b74..70a1582ba64 100644 ---- a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json -+++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json -@@ -1146,6 +1146,23 @@ - "fedora-x64" - ] - }, -+ "fedora.37": { -+ "#import": [ -+ "fedora" -+ ] -+ }, -+ "fedora.37-arm64": { -+ "#import": [ -+ "fedora.37", -+ "fedora-arm64" -+ ] -+ }, -+ "fedora.37-x64": { -+ "#import": [ -+ "fedora.37", -+ "fedora-x64" -+ ] -+ }, - "freebsd": { - "#import": [ - "unix" -diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props b/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props -index 1945bb9af0e..75c6d28a30f 100644 ---- a/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props -+++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props -@@ -71,7 +71,7 @@ - - linux - x64;arm64 -- 23;24;25;26;27;28;29;30;31;32;33;34;35;36 -+ 23;24;25;26;27;28;29;30;31;32;33;34;35;36;37 - false - - diff --git a/runtime-mono-remove-ilstrip.patch b/runtime-mono-remove-ilstrip.patch deleted file mode 100644 index 9a711f8..0000000 --- a/runtime-mono-remove-ilstrip.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff --git a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj -index 724b704f864..3dabdc81dae 100644 ---- a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj -+++ b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj -@@ -6,7 +6,7 @@ - - - -- -+ - - - -@@ -15,7 +15,7 @@ - - - -- -+ - - - -diff --git a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/Sdk.props b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/Sdk.props -index 8a7ede79242..cfd515eeca9 100644 ---- a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/Sdk.props -+++ b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/Sdk.props -@@ -1,5 +1,5 @@ - -- -+ - - - diff --git a/sdk-22373-portablerid.patch b/sdk-22373-portablerid.patch deleted file mode 100644 index 8b39eb3..0000000 --- a/sdk-22373-portablerid.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 499fcf6e3b0e4b01a9c340a06f00cfc3e1fcc5d2 Mon Sep 17 00:00:00 2001 -From: Tom Deseyn -Date: Tue, 5 Oct 2021 09:04:14 +0200 -Subject: [PATCH] Use the portable rid for --use-current-runtime. - ---- - .../targets/Microsoft.NET.RuntimeIdentifierInference.targets | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets -index 17308aa9160..e764b2d9845 100644 ---- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets -+++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets -@@ -62,7 +62,7 @@ Copyright (c) .NET Foundation. All rights reserved. - - - -- $(NETCoreSdkRuntimeIdentifier) -+ $(NETCoreSdkPortableRuntimeIdentifier) - - - diff --git a/sdk-telemetry-optout.patch b/sdk-telemetry-optout.patch deleted file mode 100644 index d6e6464..0000000 --- a/sdk-telemetry-optout.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/src/Cli/dotnet/Program.cs b/src/Cli/dotnet/Program.cs -index de1ebb9e6..6bbf479de 100644 ---- a/src/Cli/dotnet/Program.cs -+++ b/src/Cli/dotnet/Program.cs -@@ -28,6 +28,13 @@ public class Program - - public static int Main(string[] args) - { -+ // opt out of telemetry by default if the env var is unset -+ string telemetryValue = Environment.GetEnvironmentVariable("DOTNET_CLI_TELEMETRY_OPTOUT"); -+ if (String.IsNullOrEmpty(telemetryValue)) -+ { -+ Environment.SetEnvironmentVariable("DOTNET_CLI_TELEMETRY_OPTOUT", "1"); -+ } -+ - DebugHelper.HandleDebugSwitch(ref args); - - // Capture the current timestamp to calculate the host overhead. diff --git a/vstest-use-work-tree-with-git-apply.patch b/vstest-use-work-tree-with-git-apply.patch deleted file mode 100644 index 58c139f..0000000 --- a/vstest-use-work-tree-with-git-apply.patch +++ /dev/null @@ -1,33 +0,0 @@ -From b2c4b2427d8c1a2410c4210789caccf1ec87e64a Mon Sep 17 00:00:00 2001 -From: Omair Majid -Date: Thu, 9 Sep 2021 13:21:51 -0400 -Subject: [PATCH] [ArPow] Use --work-tree with git apply - -This makes things work better in a source-tarball build, where there may -be a .git directory somewhere in our parent directories but it's for a -different repo than vstest. In a situation like that a plain `git apply` -will (silently!) ignore patches because they wont apply to the unrelated -repository. That will (eventually) make the source-build fail. -`--work-tree` makes git directly use the directory that we care about. - -See https://github.com/dotnet/source-build/issues/2445 for more details. ---- - eng/SourceBuild.props | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props -index b365645c..68f82592 100644 ---- a/eng/SourceBuild.props -+++ b/eng/SourceBuild.props -@@ -24,7 +24,7 @@ - - - - --- -2.31.1 - diff --git a/xliff-tasks-use-work-tree-with-git-apply.patch b/xliff-tasks-use-work-tree-with-git-apply.patch deleted file mode 100644 index 810cf67..0000000 --- a/xliff-tasks-use-work-tree-with-git-apply.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/eng/SourceBuild.props -+++ b/eng/SourceBuild.props -@@ -15,7 +15,7 @@ - - - -