Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Presets with $env{} are not checked for circular references. #2781

Closed
hwhsu1231 opened this issue Oct 8, 2022 · 2 comments · Fixed by #3905
Closed

[bug] Presets with $env{} are not checked for circular references. #2781

hwhsu1231 opened this issue Oct 8, 2022 · 2 comments · Fixed by #3905
Assignees
Labels
bug a bug in the product Feature: presets
Milestone

Comments

@hwhsu1231
Copy link

Brief Issue Summary

This issue is related to the topic I posted in CMake Discourse.

In short, it should FAIL to configure the project when using $env{} like the following example:

"environment": {
  "PATH": "C:/msys64/mingw64/bin;$env{PATH}"
},

And it failed as I expected when operating in Terminal.

F:\Git-Repo\cmake-project-template-conan>cmake --preset win32-gcc-x64-mingw-debug
CMake Error: Could not read presets from F:/Git-Repo/cmake-project-template-conan: Invalid macro expansion

However, it somehow could work with CMake Tools in Visual Studio Code. According to what Kyle Edwards said:

The $env{...} macro is supposed to reference other environment variables within the environment map, or the environment inherited from the parent process if the corresponding variable doesn’t exist. The problem is that if PATH contains $env{PATH}, then it’s referencing itself, creating a circular dependency. The purpose of $penv{...} is to break this cycle by only using the environment inherited from the parent process. If "PATH": "$env{PATH}" works in VSCode then it sounds like they didn’t implement their preset support properly.

Environments and Versions

  • Visual Studio Code: 1.71.2
  • CMake Tools: 1.13.11

Screenshots

2af6809a9d09c181f7bf52a7e48f5f1d1744b57f

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

No response

@hwhsu1231 hwhsu1231 changed the title [bug] Not implement preset support properly with $env{} and $penv{}. [bug] Not implement preset support properly with $env{}. Oct 8, 2022
@bobbrow bobbrow added bug a bug in the product Feature: presets labels Oct 10, 2022
@bobbrow
Copy link
Member

bobbrow commented Oct 10, 2022

It looks like we marked it as a warning instead of an error.

@elahehrashedi elahehrashedi added this to the Backlog milestone Oct 11, 2022
@github-project-automation github-project-automation bot moved this to Triage Needed in CMake Tools Nov 29, 2023
@gcampbell-msft gcampbell-msft moved this from Triage Needed to Pending Prioritization in CMake Tools Nov 29, 2023
@gcampbell-msft gcampbell-msft modified the milestones: Backlog, 1.19 Jun 24, 2024
@gcampbell-msft gcampbell-msft moved this from Pending Prioritization to To Do in CMake Tools Jun 24, 2024
@qarni qarni changed the title [bug] Not implement preset support properly with $env{}. [bug] Preset with $env{} are not checked for circular references. Jul 9, 2024
@qarni qarni changed the title [bug] Preset with $env{} are not checked for circular references. [bug] Presets with $env{} are not checked for circular references. Jul 9, 2024
@qarni
Copy link
Contributor

qarni commented Jul 9, 2024

Related to #2934

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug a bug in the product Feature: presets
Projects
Status: Completed
Development

Successfully merging a pull request may close this issue.

5 participants