Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 5, 2025

The DCLR_DOTNET_HOST_PATH cmake option fails when the path contains spaces on Unix systems.

Changes

  • src/coreclr/runtime.proj: Removed -DCLR_DOTNET_HOST_PATH cmake argument
  • src/coreclr/clrdatadescriptors.cmake: Changed from ${CLR_DOTNET_HOST_PATH} to dotnet directly

The build system already places dotnet on PATH via dotnet.sh and InitializeDotNetCli, making the explicit path parameter unnecessary. This eliminates the quoting issue and aligns with the existing comment in clrdatadescriptors.cmake stating "this just uses dotnet from the PATH."

Original prompt

This section details on the original issue you should resolve

<issue_title>DCLR_DOTNET_HOST_PATH cmake option doesn't support spaces in path</issue_title>
<issue_description>If there are spaces in the path on unix they seem to get dropped and the build fails.</issue_description>

Comments on the Issue (you are @copilot in this section)

@agocke I wonder whether this option is necessary at all. If we're using the dotnet.sh script to download a custom dotnet it should be placed on the path. I don't think we should need to pass this down explicitly.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

The CLR_DOTNET_HOST_PATH cmake option doesn't support spaces in paths.
Instead of trying to fix the quoting, simplify by using 'dotnet' from PATH.
This aligns with the comment in clrdatadescriptors.cmake that says the code
"just uses `dotnet` from the PATH", and with the design intent where
dotnet.sh places dotnet on the PATH.

Co-authored-by: agocke <[email protected]>
Copilot AI changed the title [WIP] Fix DCLR_DOTNET_HOST_PATH cmake option for spaces in path Remove DCLR_DOTNET_HOST_PATH cmake parameter, use dotnet from PATH Dec 5, 2025
Copilot AI requested a review from agocke December 5, 2025 05:04
Copilot finished work on behalf of agocke December 5, 2025 05:04
@am11
Copy link
Member

am11 commented Dec 5, 2025

Why not simply change COMMAND ${CLR_DOTNET_HOST_PATH} ${CDAC_BUILD_TOOL_BINARY_PATH} ... to COMMAND "${CLR_DOTNET_HOST_PATH}" "${CDAC_BUILD_TOOL_BINARY_PATH}" ...? We shouldn't be using "dotnet from PATH", it fails when building in a new container scenarios (in a self-contained manner; where dotnet is not installed).

@agocke
Copy link
Member

agocke commented Dec 5, 2025

The problem isn’t in this file, it’s all the way up the chain of our Shell scripts. They aren’t preserving the quotes properly.

In the container scenario, dotnet.sh should be placing dotnet on the path, so I don’t see why it wouldn’t work.

@am11
Copy link
Member

am11 commented Dec 5, 2025

The problem isn’t in this file, it’s all the way up the chain of our Shell scripts. They aren’t preserving the quotes properly.

That's what cmake will take care of, we just need to quote first two path args. On this same line, we have CONTRACT_BASELINE_DIR which can also have space but that doesn't fail because it's quoted.

@agocke
Copy link
Member

agocke commented Dec 5, 2025

That's what cmake will take care of, we just need to quote first two path args.

I know you haven't validated this because I did, and that doesn't work.

@am11
Copy link
Member

am11 commented Dec 5, 2025

@agocke, do you mean having spaces in CDAC_BUILD_TOOL_BINARY_PATH without quotes and CONTRACT_BASELINE_DIR with quotes cause no problem but having CLR_DOTNET_HOST_PATH with or without quotes causes problem? That's strange.

@agocke
Copy link
Member

agocke commented Dec 5, 2025

having spaces in CDAC_BUILD_TOOL_BINARY_PATH without quotes and CONTRACT_BASELINE_DIR with quotes cause no problem

They may -- in my repro the paths do not have spaces. But my Mac does have spaces in the dotnet path, and it's broken.

@agocke agocke marked this pull request as ready for review December 6, 2025 00:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the DCLR_DOTNET_HOST_PATH cmake parameter that fails when paths contain spaces on Unix systems. The build system already ensures dotnet is available in PATH through dotnet.sh and InitializeDotNetCli, making the explicit path parameter redundant.

  • Removes the cmake argument that passes DOTNET_HOST_PATH to the build system
  • Updates the cmake command to use dotnet directly from PATH instead of the variable

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/coreclr/runtime.proj Removes the -DCLR_DOTNET_HOST_PATH cmake argument from the build configuration
src/coreclr/clrdatadescriptors.cmake Changes from using ${CLR_DOTNET_HOST_PATH} variable to directly invoking dotnet from PATH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DCLR_DOTNET_HOST_PATH cmake option doesn't support spaces in path

3 participants