Skip to content

Commit bef226e

Browse files
authored
Escape all paths in DownloadLibDatadog (#7583)
## Summary of changes This wraps all paths in `DownloadLibDatadog` so that we don't run into issues of spaces in the paths. ## Reason for change Fails to build if you are running the build script from a directory that has a space in it. ## Implementation details Extracted some of the paths and then quoted them all. ## Test coverage Ran locally in a directory -> `C:/Delete Me/dd-trace-dotnet/` and it failed. With this it passed. ## Other details <!-- Fixes #{issue} --> <!-- ⚠️ Note: Where possible, please obtain 2 approvals prior to merging. Unless CODEOWNERS specifies otherwise, for external teams it is typically best to have one review from a team member, and one review from apm-dotnet. Trivial changes do not require 2 reviews. MergeQueue is NOT enabled in this repository. If you have write access to the repo, the PR has 1-2 approvals (see above), and all of the required checks have passed, you can use the Squash and Merge button to merge the PR. If you don't have write access, or you need help, reach out in the #apm-dotnet channel in Slack. -->
1 parent 99cb14c commit bef226e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tracer/build/_build/Build.Steps.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,10 +609,19 @@ async Task DownloadWafVersion(string libddwafVersion = null, string uncompressFo
609609
var vcpkgExePath = await GetVcpkg();
610610
var vcpkgRoot = Environment.GetEnvironmentVariable("VCPKG_ROOT") ?? Directory.GetParent(vcpkgExePath).FullName;
611611
var vcpkg = ToolResolver.GetLocalTool(vcpkgExePath);
612+
612613
foreach (var arch in new[] { MSBuildTargetPlatform.x64, MSBuildTargetPlatform.x86 })
613614
{
615+
var triplet = $"{arch}-windows";
616+
// note that the following are all quoted when entered into the vcpkg call itself
617+
// this is necessary to support cases where we have a space in the folder name
618+
var installRoot = $@"{BuildArtifactsDirectory}\deps\vcpkg\{triplet}";
619+
var downloads = $@"{BuildArtifactsDirectory}\obj\vcpkg\downloads";
620+
var packages = $@"{BuildArtifactsDirectory}\obj\vcpkg\packages";
621+
var buildTrees = $@"{BuildArtifactsDirectory}\obj\vcpkg\buildtrees";
622+
614623
// This big line is the same generated by VS when installing libdatadog while building the profiler
615-
vcpkg($"install --x-wait-for-lock --triplet \"{arch}-windows\" --vcpkg-root \"{vcpkgRoot}\" \"--x-manifest-root={RootDirectory}\" \"--x-install-root={BuildArtifactsDirectory}\\deps\\vcpkg\\{arch}-windows\" --downloads-root {BuildArtifactsDirectory}\\obj\\vcpkg\\downloads --x-packages-root {BuildArtifactsDirectory}\\obj\\vcpkg\\packages --x-buildtrees-root {BuildArtifactsDirectory}\\obj\\vcpkg/buildtrees --clean-after-build");
624+
vcpkg($@"install --x-wait-for-lock --triplet ""{triplet}"" --vcpkg-root ""{vcpkgRoot}"" ""--x-manifest-root={RootDirectory}"" ""--x-install-root={installRoot}"" --downloads-root ""{downloads}"" --x-packages-root ""{packages}"" --x-buildtrees-root ""{buildTrees}"" --clean-after-build");
616625
}
617626
}
618627
});
@@ -2736,14 +2745,15 @@ private async Task<string> GetVcpkg()
27362745
// Check if already downloaded
27372746
var vcpkgRoot = RootDirectory / "artifacts" / "bin" / "vcpkg";
27382747
var vcpkgExecPath = vcpkgRoot / "vcpkg.exe";
2748+
var bootstrap = vcpkgRoot / "bootstrap-vcpkg.bat";
27392749

27402750
if (File.Exists(vcpkgExecPath))
27412751
{
27422752
return $"{vcpkgExecPath}";
27432753
}
27442754

27452755
await DownloadAndExtractVcpkg(vcpkgRoot);
2746-
Cmd.Value(arguments: $"cmd /c {vcpkgRoot / "bootstrap-vcpkg.bat"}");
2756+
Cmd.Value(arguments: $@"cmd /c ""{bootstrap}""");
27472757
return $"{vcpkgRoot / "vcpkg.exe"}";
27482758
}
27492759

0 commit comments

Comments
 (0)