From f60243d63918860c2e2969dbe015d7afd99a6a40 Mon Sep 17 00:00:00 2001 From: carlossanlop Date: Thu, 16 Jun 2022 12:47:04 -0700 Subject: [PATCH 1/8] Add PlatformDetection.SupportsHardLinkCreation property. --- .../Common/tests/TestUtilities/System/PlatformDetection.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index f2c5481509817b..587b49426de2ad 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -238,6 +238,7 @@ private static bool GetAlpnSupport() public static bool SupportsAlpn => s_supportsAlpn.Value; public static bool SupportsClientAlpn => SupportsAlpn || IsOSX || IsMacCatalyst || IsiOS || IstvOS; + public static bool SupportsHardLinkCreation => !PlatformDetection.IsAndroid; private static readonly Lazy s_supportsTls10 = new Lazy(GetTls10Support); private static readonly Lazy s_supportsTls11 = new Lazy(GetTls11Support); From ad5a9512c9b8dd203732359dbc98e79ed82e6884 Mon Sep 17 00:00:00 2001 From: carlossanlop Date: Thu, 16 Jun 2022 12:47:52 -0700 Subject: [PATCH 2/8] Fix how paths are combined/joined and sanitized on extraction, to ensure paths with redundant segments get properly handled. --- .../src/System/Formats/Tar/TarEntry.cs | 41 +++++++++---------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarEntry.cs b/src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarEntry.cs index a2328ea9691a3c..ca1e482cb82639 100644 --- a/src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarEntry.cs +++ b/src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarEntry.cs @@ -261,9 +261,13 @@ internal void ExtractRelativeToDirectory(string destinationDirectoryPath, bool o Debug.Assert(!string.IsNullOrEmpty(destinationDirectoryPath)); Debug.Assert(Path.IsPathFullyQualified(destinationDirectoryPath)); - string destinationDirectoryFullPath = destinationDirectoryPath.EndsWith(Path.DirectorySeparatorChar) ? destinationDirectoryPath : destinationDirectoryPath + Path.DirectorySeparatorChar; + destinationDirectoryPath = Path.TrimEndingDirectorySeparator(destinationDirectoryPath); - string fileDestinationPath = GetSanitizedFullPath(destinationDirectoryFullPath, Name, SR.TarExtractingResultsFileOutside); + string? fileDestinationPath = GetSanitizedFullPath(destinationDirectoryPath, Name); + if (fileDestinationPath == null) + { + throw new IOException(string.Format(SR.TarExtractingResultsFileOutside, Name, destinationDirectoryPath)); + } string? linkTargetPath = null; if (EntryType is TarEntryType.SymbolicLink or TarEntryType.HardLink) @@ -273,7 +277,11 @@ internal void ExtractRelativeToDirectory(string destinationDirectoryPath, bool o throw new FormatException(SR.TarEntryHardLinkOrSymlinkLinkNameEmpty); } - linkTargetPath = GetSanitizedFullPath(destinationDirectoryFullPath, LinkName, SR.TarExtractingResultsLinkOutside); + linkTargetPath = GetSanitizedFullPath(destinationDirectoryPath, LinkName); + if (linkTargetPath == null) + { + throw new IOException(string.Format(SR.TarExtractingResultsLinkOutside, LinkName, destinationDirectoryPath)); + } } if (EntryType == TarEntryType.Directory) @@ -286,26 +294,15 @@ internal void ExtractRelativeToDirectory(string destinationDirectoryPath, bool o Directory.CreateDirectory(Path.GetDirectoryName(fileDestinationPath)!); ExtractToFileInternal(fileDestinationPath, linkTargetPath, overwrite); } + } - // If the path can be extracted in the specified destination directory, returns the full path with sanitized file name. Otherwise, throws. - static string GetSanitizedFullPath(string destinationDirectoryFullPath, string path, string exceptionMessage) - { - string actualPath = Path.Join(Path.GetDirectoryName(path), ArchivingUtils.SanitizeEntryFilePath(Path.GetFileName(path))); - - if (!Path.IsPathFullyQualified(actualPath)) - { - actualPath = Path.Combine(destinationDirectoryFullPath, actualPath); - } - - actualPath = Path.GetFullPath(actualPath); - - if (!actualPath.StartsWith(destinationDirectoryFullPath, PathInternal.StringComparison)) - { - throw new IOException(string.Format(exceptionMessage, path, destinationDirectoryFullPath)); - } - - return actualPath; - } + // If the path can be extracted in the specified destination directory, returns the full path with sanitized file name. Otherwise, returns null. + private static string? GetSanitizedFullPath(string destinationDirectoryFullPath, string path) + { + string fullyQualifiedPath = Path.IsPathFullyQualified(path) ? path : Path.Combine(destinationDirectoryFullPath, path); + string normalizedPath = Path.GetFullPath(fullyQualifiedPath); // Removes relative segments + string sanitizedPath = Path.Join(Path.GetDirectoryName(normalizedPath), ArchivingUtils.SanitizeEntryFilePath(Path.GetFileName(normalizedPath))); + return sanitizedPath.StartsWith(destinationDirectoryFullPath, PathInternal.StringComparison) ? sanitizedPath : null; } // Extracts the current entry into the filesystem, regardless of the entry type. From 1f0c436efa008683a9249d6f961a952854f619da Mon Sep 17 00:00:00 2001 From: carlossanlop Date: Thu, 16 Jun 2022 12:49:06 -0700 Subject: [PATCH 3/8] Add tests that verify archives with entries whose paths start with .\, including the root folder itself. --- .../tests/System.Formats.Tar.Tests.csproj | 2 + .../TarFile.ExtractToDirectory.File.Tests.cs | 23 +++++++++ .../TarReader.ExtractToFile.Tests.Unix.cs | 45 +++++++++++++++++ .../TarReader.ExtractToFile.Tests.cs | 50 ++++++++----------- .../tests/TarReader/TarReader.File.Tests.cs | 15 ++++++ .../System.Formats.Tar/tests/TarTestsBase.cs | 15 ++++++ 6 files changed, 122 insertions(+), 28 deletions(-) create mode 100644 src/libraries/System.Formats.Tar/tests/TarReader/TarReader.ExtractToFile.Tests.Unix.cs diff --git a/src/libraries/System.Formats.Tar/tests/System.Formats.Tar.Tests.csproj b/src/libraries/System.Formats.Tar/tests/System.Formats.Tar.Tests.csproj index 3b53355dd6b46b..95cbdd4e41e811 100644 --- a/src/libraries/System.Formats.Tar/tests/System.Formats.Tar.Tests.csproj +++ b/src/libraries/System.Formats.Tar/tests/System.Formats.Tar.Tests.csproj @@ -17,6 +17,7 @@ + @@ -52,6 +53,7 @@ + diff --git a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.File.Tests.cs b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.File.Tests.cs index 70453f4d49931e..a753358cb8a394 100644 --- a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.File.Tests.cs +++ b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.File.Tests.cs @@ -136,5 +136,28 @@ public void Extract_AllSegmentsOfPath() string filePath = Path.Join(segment2Path, "file.txt"); Assert.True(File.Exists(filePath), $"{filePath}' does not exist."); } + + [Fact] + public void ExtractArchiveWithEntriesThatStartWithSlashDotPrefix() + { + using TempDirectory root = new TempDirectory(); + + using MemoryStream archiveStream = GetStrangeTarMemoryStream("prefixDotSlashAndCurrentFolderEntry"); + + TarFile.ExtractToDirectory(archiveStream, root.Path, overwriteFiles: true); + + archiveStream.Position = 0; + + using TarReader reader = new TarReader(archiveStream, leaveOpen: false); + + TarEntry entry; + while ((entry = reader.GetNextEntry()) != null) + { + // Normalize the path (remove redundant segments), remove trailing separators + // this is so the first entry can be skipped if it's the same as the root directory + string entryPath = Path.TrimEndingDirectorySeparator(Path.GetFullPath(Path.Join(root.Path, entry.Name))); + Assert.True(Path.Exists(entryPath), $"Entry was not extracted: {entryPath}"); + } + } } } diff --git a/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.ExtractToFile.Tests.Unix.cs b/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.ExtractToFile.Tests.Unix.cs new file mode 100644 index 00000000000000..a4333bb2179285 --- /dev/null +++ b/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.ExtractToFile.Tests.Unix.cs @@ -0,0 +1,45 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using Xunit; + +namespace System.Formats.Tar.Tests +{ + public partial class TarReader_ExtractToFile_Tests : TarTestsBase + { + [Fact] + public void ExtractToFile_SpecialFile_Unelevated_Throws() + { + using TempDirectory root = new TempDirectory(); + using MemoryStream ms = GetTarMemoryStream(CompressionMethod.Uncompressed, TestTarFormat.ustar, "specialfiles"); + + using TarReader reader = new TarReader(ms); + + string path = Path.Join(root.Path, "output"); + + // Block device requires elevation for writing + PosixTarEntry blockDevice = reader.GetNextEntry() as PosixTarEntry; + Assert.NotNull(blockDevice); + Assert.Throws(() => blockDevice.ExtractToFile(path, overwrite: false)); + Assert.False(File.Exists(path)); + + // Character device requires elevation for writing + PosixTarEntry characterDevice = reader.GetNextEntry() as PosixTarEntry; + Assert.NotNull(characterDevice); + Assert.Throws(() => characterDevice.ExtractToFile(path, overwrite: false)); + Assert.False(File.Exists(path)); + + // Fifo does not require elevation, should succeed + PosixTarEntry fifo = reader.GetNextEntry() as PosixTarEntry; + Assert.NotNull(fifo); + fifo.ExtractToFile(path, overwrite: false); + Assert.True(File.Exists(path)); + + Assert.Null(reader.GetNextEntry()); + } + } +} \ No newline at end of file diff --git a/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.ExtractToFile.Tests.cs b/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.ExtractToFile.Tests.cs index bf5b6a110b570c..c347c5e4fdc3d0 100644 --- a/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.ExtractToFile.Tests.cs +++ b/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.ExtractToFile.Tests.cs @@ -1,44 +1,38 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Collections.Generic; using System.IO; -using System.Linq; using Xunit; namespace System.Formats.Tar.Tests { - public class TarReader_ExtractToFile_Tests : TarTestsBase + public partial class TarReader_ExtractToFile_Tests : TarTestsBase { [Fact] - public void ExtractToFile_SpecialFile_Unelevated_Throws() + public void ExtractEntriesWithSlashDotPrefix() { using TempDirectory root = new TempDirectory(); - using MemoryStream ms = GetTarMemoryStream(CompressionMethod.Uncompressed, TestTarFormat.ustar, "specialfiles"); - using TarReader reader = new TarReader(ms); - - string path = Path.Join(root.Path, "output"); - - // Block device requires elevation for writing - PosixTarEntry blockDevice = reader.GetNextEntry() as PosixTarEntry; - Assert.NotNull(blockDevice); - Assert.Throws(() => blockDevice.ExtractToFile(path, overwrite: false)); - Assert.False(File.Exists(path)); - - // Character device requires elevation for writing - PosixTarEntry characterDevice = reader.GetNextEntry() as PosixTarEntry; - Assert.NotNull(characterDevice); - Assert.Throws(() => characterDevice.ExtractToFile(path, overwrite: false)); - Assert.False(File.Exists(path)); - - // Fifo does not require elevation, should succeed - PosixTarEntry fifo = reader.GetNextEntry() as PosixTarEntry; - Assert.NotNull(fifo); - fifo.ExtractToFile(path, overwrite: false); - Assert.True(File.Exists(path)); - - Assert.Null(reader.GetNextEntry()); + using MemoryStream archiveStream = GetStrangeTarMemoryStream("prefixDotSlashAndCurrentFolderEntry"); + using (TarReader reader = new TarReader(archiveStream, leaveOpen: false)) + { + string rootPath = Path.TrimEndingDirectorySeparator(root.Path); + TarEntry entry; + while ((entry = reader.GetNextEntry()) != null) + { + Assert.NotNull(entry); + Assert.StartsWith("./", entry.Name); + // Normalize the path (remove redundant segments), remove trailing separators + // this is so the first entry can be skipped if it's the same as the root directory + string entryPath = Path.TrimEndingDirectorySeparator(Path.GetFullPath(Path.Join(rootPath, entry.Name))); + if (entryPath != rootPath) + { + entry.ExtractToFile(entryPath, overwrite: true); + Assert.True(Path.Exists(entryPath), $"Entry was not extracted: {entryPath}"); + } + } + } } + } } \ No newline at end of file diff --git a/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.File.Tests.cs b/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.File.Tests.cs index 02758eba6a4f5c..314edc91683c04 100644 --- a/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.File.Tests.cs +++ b/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.File.Tests.cs @@ -556,6 +556,21 @@ public void Read_Archive_LongPath_Over255(TarEntryFormat format, TestTarFormat t Assert.Null(reader.GetNextEntry()); } + [Fact] + public void ReadEntriesWithSlashDotPrefix() + { + using MemoryStream archiveStream = GetStrangeTarMemoryStream("prefixDotSlashAndCurrentFolderEntry"); + using (TarReader reader = new TarReader(archiveStream, leaveOpen: false)) + { + TarEntry entry; + while ((entry = reader.GetNextEntry()) != null) + { + Assert.NotNull(entry); + Assert.StartsWith("./", entry.Name); + } + } + } + private void Verify_Archive_RegularFile(TarEntry file, TarEntryFormat format, IReadOnlyDictionary gea, string expectedFileName, string expectedContents) { Assert.NotNull(file); diff --git a/src/libraries/System.Formats.Tar/tests/TarTestsBase.cs b/src/libraries/System.Formats.Tar/tests/TarTestsBase.cs index fb0467593d18e1..7230b0d1ba976d 100644 --- a/src/libraries/System.Formats.Tar/tests/TarTestsBase.cs +++ b/src/libraries/System.Formats.Tar/tests/TarTestsBase.cs @@ -108,6 +108,21 @@ protected static MemoryStream GetTarMemoryStream(CompressionMethod compressionMe return ms; } + protected static string GetStrangeTarFilePath(string testCaseName) => + Path.Join(Directory.GetCurrentDirectory(), "strange", testCaseName + ".tar"); + + protected static MemoryStream GetStrangeTarMemoryStream(string testCaseName) + { + string path = GetStrangeTarFilePath(testCaseName); + MemoryStream ms = new(); + using (FileStream fs = File.OpenRead(path)) + { + fs.CopyTo(ms); + } + ms.Seek(0, SeekOrigin.Begin); + return ms; + } + protected void SetCommonRegularFile(TarEntry regularFile, bool isV7RegularFile = false) { Assert.NotNull(regularFile); From f9d3986ce451cf52b9a32b85e7735aae5e0a6344 Mon Sep 17 00:00:00 2001 From: carlossanlop Date: Thu, 16 Jun 2022 12:49:34 -0700 Subject: [PATCH 4/8] Re-enable the hardlink test, condition it to not run if platform does not support extraction of hardlinks. --- .../tests/TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs index 8b9af8b3bc3e26..52e328d7c49b83 100644 --- a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs +++ b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs @@ -97,8 +97,7 @@ public void Extract_LinkEntry_TargetOutsideDirectory(TarEntryType entryType) [ConditionalFact(typeof(MountHelper), nameof(MountHelper.CanCreateSymbolicLinks))] public void Extract_SymbolicLinkEntry_TargetInsideDirectory() => Extract_LinkEntry_TargetInsideDirectory_Internal(TarEntryType.SymbolicLink); - [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/68360", TestPlatforms.Android | TestPlatforms.LinuxBionic | TestPlatforms.iOS | TestPlatforms.tvOS)] + [ConditionalFact(nameof(PlatformDetection.SupportsHardLinkCreation))] public void Extract_HardLinkEntry_TargetInsideDirectory() => Extract_LinkEntry_TargetInsideDirectory_Internal(TarEntryType.HardLink); private void Extract_LinkEntry_TargetInsideDirectory_Internal(TarEntryType entryType) From 5454349362f81d3b00377e6d6b0319311f386693 Mon Sep 17 00:00:00 2001 From: carlossanlop Date: Thu, 16 Jun 2022 14:14:06 -0700 Subject: [PATCH 5/8] Remove unnecessary test - This same code is already being tested by TarReader_ExtractToFile_Tests.ExtractEntriesWithSlashDotPrefix --- .../tests/TarReader/TarReader.File.Tests.cs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.File.Tests.cs b/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.File.Tests.cs index 314edc91683c04..02758eba6a4f5c 100644 --- a/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.File.Tests.cs +++ b/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.File.Tests.cs @@ -556,21 +556,6 @@ public void Read_Archive_LongPath_Over255(TarEntryFormat format, TestTarFormat t Assert.Null(reader.GetNextEntry()); } - [Fact] - public void ReadEntriesWithSlashDotPrefix() - { - using MemoryStream archiveStream = GetStrangeTarMemoryStream("prefixDotSlashAndCurrentFolderEntry"); - using (TarReader reader = new TarReader(archiveStream, leaveOpen: false)) - { - TarEntry entry; - while ((entry = reader.GetNextEntry()) != null) - { - Assert.NotNull(entry); - Assert.StartsWith("./", entry.Name); - } - } - } - private void Verify_Archive_RegularFile(TarEntry file, TarEntryFormat format, IReadOnlyDictionary gea, string expectedFileName, string expectedContents) { Assert.NotNull(file); From eb77add3fbb08729b7984dd2e1b7a622ef726803 Mon Sep 17 00:00:00 2001 From: carlossanlop Date: Thu, 16 Jun 2022 14:16:51 -0700 Subject: [PATCH 6/8] Reuse test code that retrieves memory stream. --- .../System.Formats.Tar/tests/TarTestsBase.cs | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/libraries/System.Formats.Tar/tests/TarTestsBase.cs b/src/libraries/System.Formats.Tar/tests/TarTestsBase.cs index 7230b0d1ba976d..a4c19ddb78402e 100644 --- a/src/libraries/System.Formats.Tar/tests/TarTestsBase.cs +++ b/src/libraries/System.Formats.Tar/tests/TarTestsBase.cs @@ -96,24 +96,17 @@ protected static string GetTarFilePath(CompressionMethod compressionMethod, Test } // MemoryStream containing the copied contents of the specified file. Meant for reading and writing. - protected static MemoryStream GetTarMemoryStream(CompressionMethod compressionMethod, TestTarFormat format, string testCaseName) - { - string path = GetTarFilePath(compressionMethod, format, testCaseName); - MemoryStream ms = new(); - using (FileStream fs = File.OpenRead(path)) - { - fs.CopyTo(ms); - } - ms.Seek(0, SeekOrigin.Begin); - return ms; - } + protected static MemoryStream GetTarMemoryStream(CompressionMethod compressionMethod, TestTarFormat format, string testCaseName) => + GetMemoryStream(GetTarFilePath(compressionMethod, format, testCaseName)); protected static string GetStrangeTarFilePath(string testCaseName) => Path.Join(Directory.GetCurrentDirectory(), "strange", testCaseName + ".tar"); - protected static MemoryStream GetStrangeTarMemoryStream(string testCaseName) + protected static MemoryStream GetStrangeTarMemoryStream(string testCaseName) => + GetMemoryStream(GetStrangeTarFilePath(testCaseName)); + + private static MemoryStream GetMemoryStream(string path) { - string path = GetStrangeTarFilePath(testCaseName); MemoryStream ms = new(); using (FileStream fs = File.OpenRead(path)) { From 52ea9bc1a8a2195909629e2185bebd73e16d9ee1 Mon Sep 17 00:00:00 2001 From: carlossanlop Date: Fri, 17 Jun 2022 09:28:56 -0700 Subject: [PATCH 7/8] Bump test data package version --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d629df7063f7b4..92accd2d9647bd 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -138,9 +138,9 @@ https://github.com/dotnet/runtime-assets 0920468fa7db4ee8ea8bbcba186421cb92713adf - + https://github.com/dotnet/runtime-assets - 0920468fa7db4ee8ea8bbcba186421cb92713adf + 371af1f99788b76eae14b96aad4ab7ac9b373938 https://github.com/dotnet/runtime-assets diff --git a/eng/Versions.props b/eng/Versions.props index c9cd5414c496b9..479b25b159147b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -120,7 +120,7 @@ 7.0.0-beta.22281.1 7.0.0-beta.22281.1 7.0.0-beta.22281.1 - 7.0.0-beta.22281.1 + 7.0.0-beta.22313.1 7.0.0-beta.22281.1 7.0.0-beta.22281.1 7.0.0-beta.22281.1 From f60153dadf0ac4618d62f1f011ce142167bfdd53 Mon Sep 17 00:00:00 2001 From: carlossanlop Date: Fri, 17 Jun 2022 09:36:38 -0700 Subject: [PATCH 8/8] Add missing typeof(PlatformDetection) in ConditionalFact --- .../Common/tests/TestUtilities/System/PlatformDetection.cs | 2 +- .../tests/TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index 587b49426de2ad..470a097e526f80 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -238,7 +238,7 @@ private static bool GetAlpnSupport() public static bool SupportsAlpn => s_supportsAlpn.Value; public static bool SupportsClientAlpn => SupportsAlpn || IsOSX || IsMacCatalyst || IsiOS || IstvOS; - public static bool SupportsHardLinkCreation => !PlatformDetection.IsAndroid; + public static bool SupportsHardLinkCreation => !IsAndroid; private static readonly Lazy s_supportsTls10 = new Lazy(GetTls10Support); private static readonly Lazy s_supportsTls11 = new Lazy(GetTls11Support); diff --git a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs index 52e328d7c49b83..9464e92488795e 100644 --- a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs +++ b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs @@ -97,7 +97,7 @@ public void Extract_LinkEntry_TargetOutsideDirectory(TarEntryType entryType) [ConditionalFact(typeof(MountHelper), nameof(MountHelper.CanCreateSymbolicLinks))] public void Extract_SymbolicLinkEntry_TargetInsideDirectory() => Extract_LinkEntry_TargetInsideDirectory_Internal(TarEntryType.SymbolicLink); - [ConditionalFact(nameof(PlatformDetection.SupportsHardLinkCreation))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.SupportsHardLinkCreation))] public void Extract_HardLinkEntry_TargetInsideDirectory() => Extract_LinkEntry_TargetInsideDirectory_Internal(TarEntryType.HardLink); private void Extract_LinkEntry_TargetInsideDirectory_Internal(TarEntryType entryType)