From b72e916d1e65c5102893f674a3ff85458e28c571 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 7 Dec 2023 19:21:20 +0100 Subject: [PATCH 1/6] [tests] Use shorter path for temp directory on Apple mobile platforms --- ...TarFile.ExtractToDirectory.Stream.Tests.cs | 24 ++++++++++++++----- ...le.ExtractToDirectoryAsync.Stream.Tests.cs | 24 ++++++++++++++----- 2 files changed, 36 insertions(+), 12 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 8bd60b6f3b4a5..6b6bfcc4b96d8 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 @@ -268,7 +268,6 @@ public void UnseekableStreams_RoundTrip(TestTarFormat testFormat) [Theory] [MemberData(nameof(GetExactRootDirMatchCases))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/88049", TestPlatforms.iOS | TestPlatforms.tvOS)] public void ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Directory_Throws(TarEntryFormat format, TarEntryType entryType, string fileName) { ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Directory_Throws_Internal(format, entryType, fileName, inverted: false); @@ -276,14 +275,18 @@ public void ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Directory_Throw } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/88049", TestPlatforms.iOS | TestPlatforms.tvOS)] public void ExtractToDirectory_ExactRootDirMatch_Directory_Relative_Throws() { string entryFolderName = "folder"; string destinationFolderName = "folderSibling"; +#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS + // the folder used to store files needs to have a shorter path on Apple mobile platforms, + // because the TempDirectory gets created in folder with a path longer than 100 bytes + using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/CoreSimulator/Devices/tempDir"); +#else using TempDirectory root = new TempDirectory(); - +#endif string entryFolderPath = Path.Join(root.Path, entryFolderName); string destinationFolderPath = Path.Join(root.Path, destinationFolderName); @@ -303,7 +306,6 @@ public void ExtractToDirectory_ExactRootDirMatch_Directory_Relative_Throws() [InlineData(TarEntryFormat.Ustar)] [InlineData(TarEntryFormat.Pax)] [InlineData(TarEntryFormat.Gnu)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/88049", TestPlatforms.iOS | TestPlatforms.tvOS)] public void ExtractToDirectory_ExactRootDirMatch_HardLinks_Throws(TarEntryFormat format) { ExtractToDirectory_ExactRootDirMatch_Links_Throws(format, TarEntryType.HardLink, inverted: false); @@ -359,8 +361,13 @@ private void ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Directory_Thro string entryFolderName = inverted ? "folderSibling" : "folder"; string destinationFolderName = inverted ? "folder" : "folderSibling"; +#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS + // the folder used to store files needs to have a shorter path on Apple mobile platforms, + // because the TempDirectory gets created in folder with a path longer than 100 bytes + using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/CoreSimulator/Devices/tempDir"); +#else using TempDirectory root = new TempDirectory(); - +#endif string entryFolderPath = Path.Join(root.Path, entryFolderName); string destinationFolderPath = Path.Join(root.Path, destinationFolderName); @@ -390,8 +397,13 @@ private void ExtractToDirectory_ExactRootDirMatch_Links_Throws(TarEntryFormat fo string linkTargetFileName = "file.txt"; string linkFileName = "link"; +#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS + // the folder used to store files needs to have a shorter path on Apple mobile platforms, + // because the TempDirectory gets created in folder with a path longer than 100 bytes + using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/CoreSimulator/Devices/tempDir"); +#else using TempDirectory root = new TempDirectory(); - +#endif string entryFolderPath = Path.Join(root.Path, entryFolderName); string destinationFolderPath = Path.Join(root.Path, destinationFolderName); diff --git a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs index 4a163767e9404..a0bfa3a7774f2 100644 --- a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs +++ b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs @@ -333,7 +333,6 @@ public async Task UnseekableStreams_RoundTrip_Async(TestTarFormat testFormat) [Theory] [MemberData(nameof(GetExactRootDirMatchCases))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/88049", TestPlatforms.iOS | TestPlatforms.tvOS)] public async Task ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Directory_Throws_Async(TarEntryFormat format, TarEntryType entryType, string fileName) { await ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Directory_Throws_Internal_Async(format, entryType, fileName, inverted: false); @@ -341,14 +340,18 @@ public async Task ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Directory } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/88049", TestPlatforms.iOS | TestPlatforms.tvOS)] public async Task ExtractToDirectory_ExactRootDirMatch_Directory_Relative_Throws_Async() { string entryFolderName = "folder"; string destinationFolderName = "folderSibling"; +#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS + // the folder used to store files needs to have a shorter path on Apple mobile platforms, + // because the TempDirectory gets created in folder with a path longer than 100 bytes + using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/CoreSimulator/Devices/tempDir"); +#else using TempDirectory root = new TempDirectory(); - +#endif string entryFolderPath = Path.Join(root.Path, entryFolderName); string destinationFolderPath = Path.Join(root.Path, destinationFolderName); @@ -368,7 +371,6 @@ public async Task ExtractToDirectory_ExactRootDirMatch_Directory_Relative_Throws [InlineData(TarEntryFormat.Ustar)] [InlineData(TarEntryFormat.Pax)] [InlineData(TarEntryFormat.Gnu)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/88049", TestPlatforms.iOS | TestPlatforms.tvOS)] public async Task ExtractToDirectory_ExactRootDirMatch_HardLinks_Throws_Async(TarEntryFormat format) { await ExtractToDirectory_ExactRootDirMatch_Links_Throws_Async(format, TarEntryType.HardLink, inverted: false); @@ -424,8 +426,13 @@ private async Task ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Director string entryFolderName = inverted ? "folderSibling" : "folder"; string destinationFolderName = inverted ? "folder" : "folderSibling"; +#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS + // the folder used to store files needs to have a shorter path on Apple mobile platforms, + // because the TempDirectory gets created in folder with a path longer than 100 bytes + using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/CoreSimulator/Devices/tempDir"); +#else using TempDirectory root = new TempDirectory(); - +#endif string entryFolderPath = Path.Join(root.Path, entryFolderName); string destinationFolderPath = Path.Join(root.Path, destinationFolderName); @@ -455,8 +462,13 @@ private Task ExtractToDirectory_ExactRootDirMatch_Links_Throws_Async(TarEntryFor string linkTargetFileName = "file.txt"; string linkFileName = "link"; +#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS + // the folder used to store files needs to have a shorter path on Apple mobile platforms, + // because the TempDirectory gets created in folder with a path longer than 100 bytes + using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/CoreSimulator/Devices/tempDir"); +#else using TempDirectory root = new TempDirectory(); - +#endif string entryFolderPath = Path.Join(root.Path, entryFolderName); string destinationFolderPath = Path.Join(root.Path, destinationFolderName); From 63f0e6a34aaef11eaba2f02c6543103a99951ed7 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 8 Dec 2023 12:26:08 +0100 Subject: [PATCH 2/6] [tests] Test shorter temporary directory path --- .../TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs | 6 +++--- .../TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 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 6b6bfcc4b96d8..d3a51d661cf94 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 @@ -283,7 +283,7 @@ public void ExtractToDirectory_ExactRootDirMatch_Directory_Relative_Throws() #if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS // the folder used to store files needs to have a shorter path on Apple mobile platforms, // because the TempDirectory gets created in folder with a path longer than 100 bytes - using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/CoreSimulator/Devices/tempDir"); + using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/tmp"); #else using TempDirectory root = new TempDirectory(); #endif @@ -364,7 +364,7 @@ private void ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Directory_Thro #if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS // the folder used to store files needs to have a shorter path on Apple mobile platforms, // because the TempDirectory gets created in folder with a path longer than 100 bytes - using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/CoreSimulator/Devices/tempDir"); + using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/tmp"); #else using TempDirectory root = new TempDirectory(); #endif @@ -400,7 +400,7 @@ private void ExtractToDirectory_ExactRootDirMatch_Links_Throws(TarEntryFormat fo #if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS // the folder used to store files needs to have a shorter path on Apple mobile platforms, // because the TempDirectory gets created in folder with a path longer than 100 bytes - using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/CoreSimulator/Devices/tempDir"); + using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/tmp"); #else using TempDirectory root = new TempDirectory(); #endif diff --git a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs index a0bfa3a7774f2..c290d4a87e71f 100644 --- a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs +++ b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs @@ -348,7 +348,7 @@ public async Task ExtractToDirectory_ExactRootDirMatch_Directory_Relative_Throws #if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS // the folder used to store files needs to have a shorter path on Apple mobile platforms, // because the TempDirectory gets created in folder with a path longer than 100 bytes - using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/CoreSimulator/Devices/tempDir"); + using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/tmp"); #else using TempDirectory root = new TempDirectory(); #endif @@ -429,7 +429,7 @@ private async Task ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Director #if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS // the folder used to store files needs to have a shorter path on Apple mobile platforms, // because the TempDirectory gets created in folder with a path longer than 100 bytes - using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/CoreSimulator/Devices/tempDir"); + using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/tmp"); #else using TempDirectory root = new TempDirectory(); #endif @@ -465,7 +465,7 @@ private Task ExtractToDirectory_ExactRootDirMatch_Links_Throws_Async(TarEntryFor #if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS // the folder used to store files needs to have a shorter path on Apple mobile platforms, // because the TempDirectory gets created in folder with a path longer than 100 bytes - using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/CoreSimulator/Devices/tempDir"); + using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/tmp"); #else using TempDirectory root = new TempDirectory(); #endif From bc70d4f5b0fb5c7c0ceed6629546cb0993042a53 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 8 Dec 2023 14:39:15 +0100 Subject: [PATCH 3/6] [tests] Test shorter temporary directory path --- .../TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs | 6 +++--- .../TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 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 d3a51d661cf94..c5840fc24bb68 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 @@ -283,7 +283,7 @@ public void ExtractToDirectory_ExactRootDirMatch_Directory_Relative_Throws() #if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS // the folder used to store files needs to have a shorter path on Apple mobile platforms, // because the TempDirectory gets created in folder with a path longer than 100 bytes - using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/tmp"); + using TempDirectory root = new TempDirectory("/Users/helix-runner/tmp"); #else using TempDirectory root = new TempDirectory(); #endif @@ -364,7 +364,7 @@ private void ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Directory_Thro #if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS // the folder used to store files needs to have a shorter path on Apple mobile platforms, // because the TempDirectory gets created in folder with a path longer than 100 bytes - using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/tmp"); + using TempDirectory root = new TempDirectory("/Users/helix-runner/tmp"); #else using TempDirectory root = new TempDirectory(); #endif @@ -400,7 +400,7 @@ private void ExtractToDirectory_ExactRootDirMatch_Links_Throws(TarEntryFormat fo #if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS // the folder used to store files needs to have a shorter path on Apple mobile platforms, // because the TempDirectory gets created in folder with a path longer than 100 bytes - using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/tmp"); + using TempDirectory root = new TempDirectory("/Users/helix-runner/tmp"); #else using TempDirectory root = new TempDirectory(); #endif diff --git a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs index c290d4a87e71f..b86ce3fa8aafb 100644 --- a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs +++ b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs @@ -348,7 +348,7 @@ public async Task ExtractToDirectory_ExactRootDirMatch_Directory_Relative_Throws #if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS // the folder used to store files needs to have a shorter path on Apple mobile platforms, // because the TempDirectory gets created in folder with a path longer than 100 bytes - using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/tmp"); + using TempDirectory root = new TempDirectory("/Users/helix-runner/tmp"); #else using TempDirectory root = new TempDirectory(); #endif @@ -429,7 +429,7 @@ private async Task ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Director #if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS // the folder used to store files needs to have a shorter path on Apple mobile platforms, // because the TempDirectory gets created in folder with a path longer than 100 bytes - using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/tmp"); + using TempDirectory root = new TempDirectory("/Users/helix-runner/tmp"); #else using TempDirectory root = new TempDirectory(); #endif @@ -465,7 +465,7 @@ private Task ExtractToDirectory_ExactRootDirMatch_Links_Throws_Async(TarEntryFor #if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS // the folder used to store files needs to have a shorter path on Apple mobile platforms, // because the TempDirectory gets created in folder with a path longer than 100 bytes - using TempDirectory root = new TempDirectory("/Users/helix-runner/Library/Developer/tmp"); + using TempDirectory root = new TempDirectory("/Users/helix-runner/tmp"); #else using TempDirectory root = new TempDirectory(); #endif From 40bc3bf3a549a4a0b22dc16504fa9cd14947ad4e Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 8 Dec 2023 17:15:09 +0100 Subject: [PATCH 4/6] [tests] Test macros condition for temp directory --- .../TarFile.ExtractToDirectory.Stream.Tests.cs | 15 +++------------ ...arFile.ExtractToDirectoryAsync.Stream.Tests.cs | 15 +++------------ 2 files changed, 6 insertions(+), 24 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 c5840fc24bb68..4974b897691e9 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 @@ -280,13 +280,10 @@ public void ExtractToDirectory_ExactRootDirMatch_Directory_Relative_Throws() string entryFolderName = "folder"; string destinationFolderName = "folderSibling"; -#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS // the folder used to store files needs to have a shorter path on Apple mobile platforms, // because the TempDirectory gets created in folder with a path longer than 100 bytes using TempDirectory root = new TempDirectory("/Users/helix-runner/tmp"); -#else - using TempDirectory root = new TempDirectory(); -#endif + string entryFolderPath = Path.Join(root.Path, entryFolderName); string destinationFolderPath = Path.Join(root.Path, destinationFolderName); @@ -361,13 +358,10 @@ private void ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Directory_Thro string entryFolderName = inverted ? "folderSibling" : "folder"; string destinationFolderName = inverted ? "folder" : "folderSibling"; -#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS // the folder used to store files needs to have a shorter path on Apple mobile platforms, // because the TempDirectory gets created in folder with a path longer than 100 bytes using TempDirectory root = new TempDirectory("/Users/helix-runner/tmp"); -#else - using TempDirectory root = new TempDirectory(); -#endif + string entryFolderPath = Path.Join(root.Path, entryFolderName); string destinationFolderPath = Path.Join(root.Path, destinationFolderName); @@ -397,13 +391,10 @@ private void ExtractToDirectory_ExactRootDirMatch_Links_Throws(TarEntryFormat fo string linkTargetFileName = "file.txt"; string linkFileName = "link"; -#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS // the folder used to store files needs to have a shorter path on Apple mobile platforms, // because the TempDirectory gets created in folder with a path longer than 100 bytes using TempDirectory root = new TempDirectory("/Users/helix-runner/tmp"); -#else - using TempDirectory root = new TempDirectory(); -#endif + string entryFolderPath = Path.Join(root.Path, entryFolderName); string destinationFolderPath = Path.Join(root.Path, destinationFolderName); diff --git a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs index b86ce3fa8aafb..d4849d99c8fb7 100644 --- a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs +++ b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs @@ -345,13 +345,10 @@ public async Task ExtractToDirectory_ExactRootDirMatch_Directory_Relative_Throws string entryFolderName = "folder"; string destinationFolderName = "folderSibling"; -#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS // the folder used to store files needs to have a shorter path on Apple mobile platforms, // because the TempDirectory gets created in folder with a path longer than 100 bytes using TempDirectory root = new TempDirectory("/Users/helix-runner/tmp"); -#else - using TempDirectory root = new TempDirectory(); -#endif + string entryFolderPath = Path.Join(root.Path, entryFolderName); string destinationFolderPath = Path.Join(root.Path, destinationFolderName); @@ -426,13 +423,10 @@ private async Task ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Director string entryFolderName = inverted ? "folderSibling" : "folder"; string destinationFolderName = inverted ? "folder" : "folderSibling"; -#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS // the folder used to store files needs to have a shorter path on Apple mobile platforms, // because the TempDirectory gets created in folder with a path longer than 100 bytes using TempDirectory root = new TempDirectory("/Users/helix-runner/tmp"); -#else - using TempDirectory root = new TempDirectory(); -#endif + string entryFolderPath = Path.Join(root.Path, entryFolderName); string destinationFolderPath = Path.Join(root.Path, destinationFolderName); @@ -462,13 +456,10 @@ private Task ExtractToDirectory_ExactRootDirMatch_Links_Throws_Async(TarEntryFor string linkTargetFileName = "file.txt"; string linkFileName = "link"; -#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS // the folder used to store files needs to have a shorter path on Apple mobile platforms, // because the TempDirectory gets created in folder with a path longer than 100 bytes using TempDirectory root = new TempDirectory("/Users/helix-runner/tmp"); -#else - using TempDirectory root = new TempDirectory(); -#endif + string entryFolderPath = Path.Join(root.Path, entryFolderName); string destinationFolderPath = Path.Join(root.Path, destinationFolderName); From 1fca9cff93b5338b129571ce0a3195b7ac50f3f0 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Mon, 11 Dec 2023 12:18:43 +0100 Subject: [PATCH 5/6] [tests] Disable tests on Apple mobile platforms --- .../TarFile.ExtractToDirectory.Stream.Tests.cs | 18 ++++++------------ ...ile.ExtractToDirectoryAsync.Stream.Tests.cs | 18 ++++++------------ 2 files changed, 12 insertions(+), 24 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 4974b897691e9..a2f3c6bc758f5 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 @@ -268,6 +268,7 @@ public void UnseekableStreams_RoundTrip(TestTarFormat testFormat) [Theory] [MemberData(nameof(GetExactRootDirMatchCases))] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "The temporary directory on Apple mobile platforms exceeds the path length limit.")] public void ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Directory_Throws(TarEntryFormat format, TarEntryType entryType, string fileName) { ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Directory_Throws_Internal(format, entryType, fileName, inverted: false); @@ -275,14 +276,12 @@ public void ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Directory_Throw } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "The temporary directory on Apple mobile platforms exceeds the path length limit.")] public void ExtractToDirectory_ExactRootDirMatch_Directory_Relative_Throws() { string entryFolderName = "folder"; string destinationFolderName = "folderSibling"; - - // the folder used to store files needs to have a shorter path on Apple mobile platforms, - // because the TempDirectory gets created in folder with a path longer than 100 bytes - using TempDirectory root = new TempDirectory("/Users/helix-runner/tmp"); + using TempDirectory root = new TempDirectory(); string entryFolderPath = Path.Join(root.Path, entryFolderName); string destinationFolderPath = Path.Join(root.Path, destinationFolderName); @@ -303,6 +302,7 @@ public void ExtractToDirectory_ExactRootDirMatch_Directory_Relative_Throws() [InlineData(TarEntryFormat.Ustar)] [InlineData(TarEntryFormat.Pax)] [InlineData(TarEntryFormat.Gnu)] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "The temporary directory on Apple mobile platforms exceeds the path length limit.")] public void ExtractToDirectory_ExactRootDirMatch_HardLinks_Throws(TarEntryFormat format) { ExtractToDirectory_ExactRootDirMatch_Links_Throws(format, TarEntryType.HardLink, inverted: false); @@ -357,10 +357,7 @@ private void ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Directory_Thro string entryFolderName = inverted ? "folderSibling" : "folder"; string destinationFolderName = inverted ? "folder" : "folderSibling"; - - // the folder used to store files needs to have a shorter path on Apple mobile platforms, - // because the TempDirectory gets created in folder with a path longer than 100 bytes - using TempDirectory root = new TempDirectory("/Users/helix-runner/tmp"); + using TempDirectory root = new TempDirectory(); string entryFolderPath = Path.Join(root.Path, entryFolderName); string destinationFolderPath = Path.Join(root.Path, destinationFolderName); @@ -390,10 +387,7 @@ private void ExtractToDirectory_ExactRootDirMatch_Links_Throws(TarEntryFormat fo string linkTargetFileName = "file.txt"; string linkFileName = "link"; - - // the folder used to store files needs to have a shorter path on Apple mobile platforms, - // because the TempDirectory gets created in folder with a path longer than 100 bytes - using TempDirectory root = new TempDirectory("/Users/helix-runner/tmp"); + using TempDirectory root = new TempDirectory(); string entryFolderPath = Path.Join(root.Path, entryFolderName); string destinationFolderPath = Path.Join(root.Path, destinationFolderName); diff --git a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs index d4849d99c8fb7..328d8b36107df 100644 --- a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs +++ b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs @@ -333,6 +333,7 @@ public async Task UnseekableStreams_RoundTrip_Async(TestTarFormat testFormat) [Theory] [MemberData(nameof(GetExactRootDirMatchCases))] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "The temporary directory on Apple mobile platforms exceeds the path length limit.")] public async Task ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Directory_Throws_Async(TarEntryFormat format, TarEntryType entryType, string fileName) { await ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Directory_Throws_Internal_Async(format, entryType, fileName, inverted: false); @@ -340,14 +341,12 @@ public async Task ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Directory } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "The temporary directory on Apple mobile platforms exceeds the path length limit.")] public async Task ExtractToDirectory_ExactRootDirMatch_Directory_Relative_Throws_Async() { string entryFolderName = "folder"; string destinationFolderName = "folderSibling"; - - // the folder used to store files needs to have a shorter path on Apple mobile platforms, - // because the TempDirectory gets created in folder with a path longer than 100 bytes - using TempDirectory root = new TempDirectory("/Users/helix-runner/tmp"); + using TempDirectory root = new TempDirectory(); string entryFolderPath = Path.Join(root.Path, entryFolderName); string destinationFolderPath = Path.Join(root.Path, destinationFolderName); @@ -368,6 +367,7 @@ public async Task ExtractToDirectory_ExactRootDirMatch_Directory_Relative_Throws [InlineData(TarEntryFormat.Ustar)] [InlineData(TarEntryFormat.Pax)] [InlineData(TarEntryFormat.Gnu)] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "The temporary directory on Apple mobile platforms exceeds the path length limit.")] public async Task ExtractToDirectory_ExactRootDirMatch_HardLinks_Throws_Async(TarEntryFormat format) { await ExtractToDirectory_ExactRootDirMatch_Links_Throws_Async(format, TarEntryType.HardLink, inverted: false); @@ -422,10 +422,7 @@ private async Task ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Director string entryFolderName = inverted ? "folderSibling" : "folder"; string destinationFolderName = inverted ? "folder" : "folderSibling"; - - // the folder used to store files needs to have a shorter path on Apple mobile platforms, - // because the TempDirectory gets created in folder with a path longer than 100 bytes - using TempDirectory root = new TempDirectory("/Users/helix-runner/tmp"); + using TempDirectory root = new TempDirectory(); string entryFolderPath = Path.Join(root.Path, entryFolderName); string destinationFolderPath = Path.Join(root.Path, destinationFolderName); @@ -455,10 +452,7 @@ private Task ExtractToDirectory_ExactRootDirMatch_Links_Throws_Async(TarEntryFor string linkTargetFileName = "file.txt"; string linkFileName = "link"; - - // the folder used to store files needs to have a shorter path on Apple mobile platforms, - // because the TempDirectory gets created in folder with a path longer than 100 bytes - using TempDirectory root = new TempDirectory("/Users/helix-runner/tmp"); + using TempDirectory root = new TempDirectory(); string entryFolderPath = Path.Join(root.Path, entryFolderName); string destinationFolderPath = Path.Join(root.Path, destinationFolderName); From 34ab825ba85acc6409d82b642d26b528fc2f8c87 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Mon, 11 Dec 2023 12:23:13 +0100 Subject: [PATCH 6/6] [tests] Fix lint --- .../tests/TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs | 3 +++ .../TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs | 3 +++ 2 files changed, 6 insertions(+) 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 a2f3c6bc758f5..d8f6bfb1d2b2c 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 @@ -281,6 +281,7 @@ public void ExtractToDirectory_ExactRootDirMatch_Directory_Relative_Throws() { string entryFolderName = "folder"; string destinationFolderName = "folderSibling"; + using TempDirectory root = new TempDirectory(); string entryFolderPath = Path.Join(root.Path, entryFolderName); @@ -357,6 +358,7 @@ private void ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Directory_Thro string entryFolderName = inverted ? "folderSibling" : "folder"; string destinationFolderName = inverted ? "folder" : "folderSibling"; + using TempDirectory root = new TempDirectory(); string entryFolderPath = Path.Join(root.Path, entryFolderName); @@ -387,6 +389,7 @@ private void ExtractToDirectory_ExactRootDirMatch_Links_Throws(TarEntryFormat fo string linkTargetFileName = "file.txt"; string linkFileName = "link"; + using TempDirectory root = new TempDirectory(); string entryFolderPath = Path.Join(root.Path, entryFolderName); diff --git a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs index 328d8b36107df..d56f85648914d 100644 --- a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs +++ b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs @@ -346,6 +346,7 @@ public async Task ExtractToDirectory_ExactRootDirMatch_Directory_Relative_Throws { string entryFolderName = "folder"; string destinationFolderName = "folderSibling"; + using TempDirectory root = new TempDirectory(); string entryFolderPath = Path.Join(root.Path, entryFolderName); @@ -422,6 +423,7 @@ private async Task ExtractToDirectory_ExactRootDirMatch_RegularFile_And_Director string entryFolderName = inverted ? "folderSibling" : "folder"; string destinationFolderName = inverted ? "folder" : "folderSibling"; + using TempDirectory root = new TempDirectory(); string entryFolderPath = Path.Join(root.Path, entryFolderName); @@ -452,6 +454,7 @@ private Task ExtractToDirectory_ExactRootDirMatch_Links_Throws_Async(TarEntryFor string linkTargetFileName = "file.txt"; string linkFileName = "link"; + using TempDirectory root = new TempDirectory(); string entryFolderPath = Path.Join(root.Path, entryFolderName);