From 94174a28dbf4e5b37872e2071207f0712c208746 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Fri, 17 Oct 2025 19:47:01 +0200 Subject: [PATCH 1/5] Include 16 guid chars in pipe name --- FFMpegCore/FFMpeg/Pipes/PipeHelpers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FFMpegCore/FFMpeg/Pipes/PipeHelpers.cs b/FFMpegCore/FFMpeg/Pipes/PipeHelpers.cs index cbd90ac..05d3f54 100644 --- a/FFMpegCore/FFMpeg/Pipes/PipeHelpers.cs +++ b/FFMpegCore/FFMpeg/Pipes/PipeHelpers.cs @@ -6,7 +6,7 @@ internal static class PipeHelpers { public static string GetUnqiuePipeName() { - return $"FFMpegCore_{Guid.NewGuid().ToString("N").Substring(0, 5)}"; + return $"FFMpegCore_{Guid.NewGuid().ToString("N").Substring(0, 16)}"; } public static string GetPipePath(string pipeName) From c0b5e8e52f4bc3652d46b1cd935289d42ab7a94f Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Fri, 17 Oct 2025 19:47:08 +0200 Subject: [PATCH 2/5] Fix typo --- FFMpegCore/FFMpeg/Arguments/PipeArgument.cs | 2 +- FFMpegCore/FFMpeg/Pipes/PipeHelpers.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FFMpegCore/FFMpeg/Arguments/PipeArgument.cs b/FFMpegCore/FFMpeg/Arguments/PipeArgument.cs index 4011c23..311a518 100644 --- a/FFMpegCore/FFMpeg/Arguments/PipeArgument.cs +++ b/FFMpegCore/FFMpeg/Arguments/PipeArgument.cs @@ -11,7 +11,7 @@ public abstract class PipeArgument protected PipeArgument(PipeDirection direction) { - PipeName = PipeHelpers.GetUnqiuePipeName(); + PipeName = PipeHelpers.GetUniquePipeName(); _direction = direction; } diff --git a/FFMpegCore/FFMpeg/Pipes/PipeHelpers.cs b/FFMpegCore/FFMpeg/Pipes/PipeHelpers.cs index 05d3f54..01f3416 100644 --- a/FFMpegCore/FFMpeg/Pipes/PipeHelpers.cs +++ b/FFMpegCore/FFMpeg/Pipes/PipeHelpers.cs @@ -4,7 +4,7 @@ namespace FFMpegCore.Pipes; internal static class PipeHelpers { - public static string GetUnqiuePipeName() + public static string GetUniquePipeName() { return $"FFMpegCore_{Guid.NewGuid().ToString("N").Substring(0, 16)}"; } From f0b5859afdee72044b32c97053ae278b383b8b19 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Fri, 17 Oct 2025 19:47:41 +0200 Subject: [PATCH 3/5] Add test verifying that full pipe path is less than maximum pipe path length on macos --- FFMpegCore.Test/ArgumentBuilderTest.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/FFMpegCore.Test/ArgumentBuilderTest.cs b/FFMpegCore.Test/ArgumentBuilderTest.cs index 0e6d715..b74d205 100644 --- a/FFMpegCore.Test/ArgumentBuilderTest.cs +++ b/FFMpegCore.Test/ArgumentBuilderTest.cs @@ -1,6 +1,7 @@ using System.Drawing; using FFMpegCore.Arguments; using FFMpegCore.Enums; +using FFMpegCore.Pipes; namespace FFMpegCore.Test; @@ -703,4 +704,18 @@ public class ArgumentBuilderTest var arg = new AudibleEncryptionKeyArgument("62689101"); Assert.AreEqual("-activation_bytes 62689101", arg.Text); } + + [TestMethod] + public void InputPipe_MaxLength_ShorterThanMacOsMax() + { + var pipePath = new InputPipeArgument(new StreamPipeSource(Stream.Null)).PipePath; + Assert.IsLessThan(104, pipePath.Length); + } + + [TestMethod] + public void OutputPipe_MaxLength_ShorterThanMacOsMax() + { + var pipePath = new OutputPipeArgument(new StreamPipeSink(Stream.Null)).PipePath; + Assert.IsLessThan(104, pipePath.Length); + } } From 1b0051b2340a439759e14229c461c705ce4939dc Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Fri, 17 Oct 2025 19:53:38 +0200 Subject: [PATCH 4/5] Create variable for holding macOS max pipe path length to avoid magic number --- FFMpegCore.Test/ArgumentBuilderTest.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/FFMpegCore.Test/ArgumentBuilderTest.cs b/FFMpegCore.Test/ArgumentBuilderTest.cs index b74d205..85eb6e2 100644 --- a/FFMpegCore.Test/ArgumentBuilderTest.cs +++ b/FFMpegCore.Test/ArgumentBuilderTest.cs @@ -9,6 +9,7 @@ namespace FFMpegCore.Test; public class ArgumentBuilderTest { private readonly string[] _concatFiles = { "1.mp4", "2.mp4", "3.mp4", "4.mp4" }; + private readonly int _macOsMaxPipePathLength = 104; private readonly string[] _multiFiles = { "1.mp3", "2.mp3", "3.mp3", "4.mp3" }; [TestMethod] @@ -709,13 +710,13 @@ public class ArgumentBuilderTest public void InputPipe_MaxLength_ShorterThanMacOsMax() { var pipePath = new InputPipeArgument(new StreamPipeSource(Stream.Null)).PipePath; - Assert.IsLessThan(104, pipePath.Length); + Assert.IsLessThan(_macOsMaxPipePathLength, pipePath.Length); } [TestMethod] public void OutputPipe_MaxLength_ShorterThanMacOsMax() { var pipePath = new OutputPipeArgument(new StreamPipeSink(Stream.Null)).PipePath; - Assert.IsLessThan(104, pipePath.Length); + Assert.IsLessThan(_macOsMaxPipePathLength, pipePath.Length); } } From 77d13e8143e0307ead40be44d724a623240556a2 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Fri, 17 Oct 2025 19:54:15 +0200 Subject: [PATCH 5/5] Update FFMpegCore.Test/ArgumentBuilderTest.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- FFMpegCore.Test/ArgumentBuilderTest.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FFMpegCore.Test/ArgumentBuilderTest.cs b/FFMpegCore.Test/ArgumentBuilderTest.cs index 85eb6e2..53999c3 100644 --- a/FFMpegCore.Test/ArgumentBuilderTest.cs +++ b/FFMpegCore.Test/ArgumentBuilderTest.cs @@ -707,14 +707,14 @@ public class ArgumentBuilderTest } [TestMethod] - public void InputPipe_MaxLength_ShorterThanMacOsMax() + public void InputPipe_MaxLength_ShorterThanMacOSMax() { var pipePath = new InputPipeArgument(new StreamPipeSource(Stream.Null)).PipePath; - Assert.IsLessThan(_macOsMaxPipePathLength, pipePath.Length); + Assert.IsLessThan(104, pipePath.Length); } [TestMethod] - public void OutputPipe_MaxLength_ShorterThanMacOsMax() + public void OutputPipe_MaxLength_ShorterThanMacOSMax() { var pipePath = new OutputPipeArgument(new StreamPipeSink(Stream.Null)).PipePath; Assert.IsLessThan(_macOsMaxPipePathLength, pipePath.Length);