Skip to content

Commit

Permalink
Make VBCSCompiler pipe name insensitive to casing of the path (#75852)
Browse files Browse the repository at this point in the history
* Make VBCSCompiler pipe name insensitive to casing of the path

* Improve comment wording

Co-authored-by: Jared Parsons <[email protected]>

---------

Co-authored-by: Jared Parsons <[email protected]>
  • Loading branch information
jjonescz and jaredpar authored Nov 12, 2024
1 parent 5780d35 commit d3176f5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,14 @@ public void GetPipeNameForPathOptLength()
// We only have ~50 total bytes to work with on mac, so the base path must be small
Assert.Equal(43, name.Length);
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/75714")]
public void GetPipeNameForPath_Casing()
{
var path1 = string.Format(@"q:{0}the{0}path", Path.DirectorySeparatorChar);
var path2 = string.Format(@"Q:{0}The{0}Path", Path.DirectorySeparatorChar);
Assert.Equal(BuildServerConnection.GetPipeName(path1), BuildServerConnection.GetPipeName(path2));
}
}
}
}
3 changes: 3 additions & 0 deletions src/Compilers/Shared/BuildServerConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,9 @@ internal static string GetPipeName(
// of this method.
clientDirectory = clientDirectory.TrimEnd(Path.DirectorySeparatorChar);

// Similarly, we don't want multiple servers if the provided launch path differs in casing.
clientDirectory = clientDirectory.ToLowerInvariant();

var pipeNameInput = $"{userName}.{isAdmin}.{clientDirectory}";
using (var sha = SHA256.Create())
{
Expand Down

0 comments on commit d3176f5

Please sign in to comment.