From 272f9c97c7198f82dc357a962f4d199f52c4230e Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 2 Aug 2022 14:50:05 -0400 Subject: [PATCH 1/4] Re-enable System.IO.Pipes.Tests on iOS-based platforms This seems fixed by a pipe name shortening at some point in the past --- src/libraries/tests.proj | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 80383f6943168..75be495884b95 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -329,11 +329,6 @@ - - - - - From c8c1eb3998aef97095e1afb9b26def004b38270c Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Wed, 3 Aug 2022 08:39:20 -0400 Subject: [PATCH 2/4] Work around long socket path on tvOS. tvOS has a MAX_PATH of 104 characters on domain sockets, and a 90 character value for GetTempPath. That gives us only 14 characters to play with, and temp filenames are 12 characters long. We cannot afford the `CoreFxPipe_` prefix on tvOS, with our tiny character path budget. Check whether this fixes some or all of #67853 and #51390 too. --- .../System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs index 165c9787c6875..9bab4eeace6a0 100644 --- a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs +++ b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs @@ -30,7 +30,7 @@ public abstract partial class PipeStream : Stream private static readonly char[] s_invalidPathNameChars = Path.GetInvalidPathChars(); /// Prefix to prepend to all pipe names. - private static readonly string s_pipePrefix = Path.Combine(Path.GetTempPath(), "CoreFxPipe_"); + private static readonly string s_pipePrefix = Path.Combine(Path.GetTempPath(), (RuntimeInformation.IsOSPlatform(OSPlatform.Create("TVOS"))) ? "" : "CoreFxPipe_"); public override int Read(byte[] buffer, int offset, int count) { From 97b1ff30f3c9f0d1556cbe51a836a5a5b089fca4 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Wed, 3 Aug 2022 10:29:21 -0400 Subject: [PATCH 3/4] Test a theory --- .../System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs index 9bab4eeace6a0..8816ad02f1995 100644 --- a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs +++ b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs @@ -30,7 +30,7 @@ public abstract partial class PipeStream : Stream private static readonly char[] s_invalidPathNameChars = Path.GetInvalidPathChars(); /// Prefix to prepend to all pipe names. - private static readonly string s_pipePrefix = Path.Combine(Path.GetTempPath(), (RuntimeInformation.IsOSPlatform(OSPlatform.Create("TVOS"))) ? "" : "CoreFxPipe_"); + private static readonly string s_pipePrefix = Path.Combine(Path.GetTempPath(), (RuntimeInformation.IsOSPlatform(OSPlatform.Create("TVOS"))) ? "x" : "CoreFxPipe_"); public override int Read(byte[] buffer, int offset, int count) { From 4ab77e02be7748f0587cf197ccf4e1e115645942 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Wed, 3 Aug 2022 15:29:55 -0400 Subject: [PATCH 4/4] Test a theory --- .../System.IO/tests/StreamReader/StreamReaderTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libraries/System.IO/tests/StreamReader/StreamReaderTests.cs b/src/libraries/System.IO/tests/StreamReader/StreamReaderTests.cs index 24cf85352ff2d..ab2666acd119e 100644 --- a/src/libraries/System.IO/tests/StreamReader/StreamReaderTests.cs +++ b/src/libraries/System.IO/tests/StreamReader/StreamReaderTests.cs @@ -556,7 +556,6 @@ public async Task ReadBlockAsync_RepeatsReadsUntilReadDesiredAmount() [InlineData(1, true)] [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser.")] [SkipOnPlatform(TestPlatforms.LinuxBionic, "SElinux blocks UNIX sockets")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/51390", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public async Task ReadAsync_Canceled_ThrowsException(int method, bool precanceled) { Func> func = method switch @@ -566,7 +565,7 @@ public async Task ReadAsync_Canceled_ThrowsException(int method, bool precancele _ => throw new Exception("unknown mode") }; - string pipeName = Guid.NewGuid().ToString("N"); + string pipeName = "x"; using (var serverStream = new NamedPipeServerStream(pipeName, PipeDirection.Out, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous)) using (var clientStream = new NamedPipeClientStream(".", pipeName, PipeDirection.In, PipeOptions.Asynchronous)) {