Skip to content

[bug] Workspace crash with configuration pattern #19326

@kevinpoulet

Description

@kevinpoulet

Describe the bug

Hello,

I’m on Windows 11, using VS 2022 and Python 3.13.5.

This bug seems to be a regression as it worked on 2.19.2 and other versions before and appeared in 2.20.0 but took me some time to trace the root cause. I’m currently on 2.23.0 and it is still present.

In my profile, I am changing the CMake toolchain for all recipes with a given prefix:

[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
[conf]
acme.*:tools.cmake.cmaketoolchain:generator=Ninja
tools.system.package_manager:mode=install

When used in a workspace with Conan >= 2.20, it produces the error:

ERROR: Traceback (most recent call last):
  File "C:\Softwares\Python313\Lib\site-packages\conan\cli\cli.py", line 298, in main
    cli.run(args)
    ~~~~~~~^^^^^^
  File "C:\Softwares\Python313\Lib\site-packages\conan\cli\cli.py", line 194, in run
    command.run(self._conan_api, args[0][1:])
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Softwares\Python313\Lib\site-packages\conan\cli\command.py", line 213, in run
    sub.run(conan_api, parser, *args)
    ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Softwares\Python313\Lib\site-packages\conan\cli\command.py", line 231, in run
    info = self._method(conan_api, parent_parser, self._parser, *args)
  File "C:\Softwares\Python313\Lib\site-packages\conan\cli\commands\workspace.py", line 234, in workspace_super_install
    ws_graph = conan_api.workspace.super_build_graph(deps_graph, profile_host, profile_build)
  File "C:\Softwares\Python313\Lib\site-packages\conan\api\subapi\workspace.py", line 286, in super_build_graph
    initialize_conanfile_profile(conanfile, profile_build, profile_host, CONTEXT_HOST,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                 is_build_require=False)
                                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Softwares\Python313\Lib\site-packages\conan\internal\graph\profile_node_definer.py", line 32, in initialize_conanfile_profile
    _initialize_conanfile(conanfile, profile_host, settings_host, ref)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Softwares\Python313\Lib\site-packages\conan\internal\graph\profile_node_definer.py", line 85, in _initialize_conanfile
    conanfile.conf = profile.conf.get_conanfile_conf(ref, conanfile._conan_is_consumer)  # noqa
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Softwares\Python313\Lib\site-packages\conan\internal\model\conf.py", line 621, in get_conanfile_conf
    if pattern is None or ref_matches(ref, pattern, is_consumer):
                          ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Softwares\Python313\Lib\site-packages\conan\internal\model\recipe_ref.py", line 6, in ref_matches
    assert is_consumer
           ^^^^^^^^^^^
AssertionError

ERROR:

Removing the recipe selector and keeping only tools.cmake.cmaketoolchain:generator=Ninja makes the error disappear.

How to reproduce it

I have tested acme.*:tools.system.package_manager:mode=install just to check and got the same error, so it seems to be any configuration patterns.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions