Skip to content

Conversation

@dg0yt
Copy link
Contributor

@dg0yt dg0yt commented Dec 20, 2025

Fixes microsoft/vcpkg#48892.
Implements microsoft/vcpkg#48892 (comment)

This seems to be the first test that actually covers details of handling the top-level manifest, i.e. the request is installing the given top level manifest, not unrelated ports from the registry.
Edit: The difference is how the "source control file" is passed to create_versioned_install_plan.

The PR now includes the e2e test from #1889 because it helps to understand the construction of the test in dependencies.cpp.

@dg0yt dg0yt marked this pull request as ready for review December 20, 2025 05:32
@dg0yt dg0yt marked this pull request as draft December 20, 2025 06:18
@dg0yt dg0yt closed this Dec 20, 2025
@dg0yt dg0yt reopened this Dec 20, 2025
@dg0yt dg0yt marked this pull request as ready for review December 20, 2025 06:36
@dg0yt dg0yt marked this pull request as draft December 20, 2025 14:08
if (it != m_graph.end())
{
it->second.origins.insert(origin);
it->second.default_features &= default_features_mask;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This reverts a change from #1331 and is the fix for the livelock: Do not reset default_features to false.

  • The toplevel request (ConstraintFrame) could include multiple dependencies pointing to the toplevel manifest's default features.
  • resolve_stack() calls require_port_defaults() for each of these dependencies.
  • The default_features flag of the solution data node (it->second) is what prevents the creation of multiple new resolve_stack items (ConstraintFrame).

it->second.default_features = default_features_mask;
// Implicit defaults are disabled if spec is requested from top-level spec.
// Note that if top-level doesn't also mark that reference as `[core]`, defaults will be re-engaged.
it->second.default_features = origin != m_toplevel.name();
Copy link
Contributor Author

@dg0yt dg0yt Dec 22, 2025

Choose a reason for hiding this comment

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

This is not a revert but retains the actual fix from #1331: Fixing the initialization of the flag.

There are three places which engage the actual default features:

  • For the input to the vcpkg install command, default features are initialy unrolled in commands.install.cpp, subject to command line switch.
  • For dependencies requested from the toplevel manifest (name), the value is false. Actual default features can be engaged by require_port_defaults(), subject to explicit dependencies in the resolve_stack items (ConstraintFrame).
  • For dependencies requested from other manifests, , the value is true. The actual default features are engaged by require_scfl() called three lines later.

Copy link
Member

Choose a reason for hiding this comment

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

Q: Why isn't this |=?
A: Because we know it was already false/unset because if we had not inserted a new node, the if (it != m_graph.end()) branch would have been entered.

No change requested.

@dg0yt dg0yt marked this pull request as ready for review December 22, 2025 10:36
@dg0yt
Copy link
Contributor Author

dg0yt commented Dec 22, 2025

Now it should be the right fix, rectifying changes from #1331.

I removed cleanup and optimization from this PR. I would submit these usefull improvements after this PR. In addition, I think that PackageNode must become a struct with properly named members instead of a std::pair with non-tell first and second members.

Copy link
Member

@BillyONeal BillyONeal left a comment

Choose a reason for hiding this comment

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

Thanks!

"@
Throw-IfNonContains -Expected $expected -Actual $output

# This e2e tests is mirred in the dependencies.cpp test.
Copy link
Member

Choose a reason for hiding this comment

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

FWIW, if we can test it with a unit test I don't think an e2e test is strictly needed but I'm not going to say no to more tests :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without the e2e test, you miss one the "three places which engage the actual default features", command.install.cpp.

it->second.default_features = default_features_mask;
// Implicit defaults are disabled if spec is requested from top-level spec.
// Note that if top-level doesn't also mark that reference as `[core]`, defaults will be re-engaged.
it->second.default_features = origin != m_toplevel.name();
Copy link
Member

Choose a reason for hiding this comment

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

Q: Why isn't this |=?
A: Because we know it was already false/unset because if we had not inserted a new node, the if (it != m_graph.end()) branch would have been entered.

No change requested.

@BillyONeal BillyONeal merged commit 8aaa065 into microsoft:main Jan 8, 2026
7 checks passed
@dg0yt dg0yt deleted the live-lock branch January 8, 2026 22:08
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.

vcpkg doesn't fail and consumes RAM when a library lists itself as a dependency

3 participants