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] "conan install . --channel xxx" raises AssertionError #14430

Closed
db4 opened this issue Aug 5, 2023 · 3 comments · Fixed by #14444
Closed

[bug] "conan install . --channel xxx" raises AssertionError #14430

db4 opened this issue Aug 5, 2023 · 3 comments · Fixed by #14444
Assignees
Labels
Milestone

Comments

@db4
Copy link
Contributor

db4 commented Aug 5, 2023

Environment details

  • Conan version: 2.0.9

Steps to reproduce

Execute conan install for an arbitrary consumer recipe with --channel option:

conan install . --channel xxx

It will break with AssertionError. Of course, it doesn't make much sense to specify --channel for a consumer recipe but I believe it should be handled correctly. Another problem is that the exception info goes to stdout instead of stderr. So for

conan install . --channel xxx --format=json > build.json

there is no visible error on the console. Can you also fix that?

Logs

conan install . --channel xxx
...
Traceback (most recent call last):
  File "c:\work\conan-2.0\lib\site-packages\conan\cli\cli.py", line 272, in main
    cli.run(args)
  File "c:\work\conan-2.0\lib\site-packages\conan\cli\cli.py", line 172, in run
    command.run(self._conan_api, args[0][1:])
  File "c:\work\conan-2.0\lib\site-packages\conan\cli\command.py", line 125, in run
    info = self._method(conan_api, parser, *args)
  File "c:\work\conan-2.0\lib\site-packages\conan\cli\commands\install.py", line 65, in install
    deps_graph = conan_api.graph.load_graph_consumer(path, args.name, args.version,
  File "c:\work\conan-2.0\lib\site-packages\conan\api\subapi\graph.py", line 132, in load_graph_consumer
    root_node = self._load_root_consumer_conanfile(path, profile_host, profile_build,
  File "c:\work\conan-2.0\lib\site-packages\conan\api\subapi\graph.py", line 24, in _load_root_consumer_conanfile
    conanfile = app.loader.load_consumer(path,
  File "c:\work\conan-2.0\lib\site-packages\conans\client\loader.py", line 166, in load_consumer
    if str(ref):
  File "c:\work\conan-2.0\lib\site-packages\conans\model\recipe_ref.py", line 62, in __str__
    assert self.user
AssertionError
@memsharded memsharded self-assigned this Aug 7, 2023
@memsharded memsharded added the bug label Aug 7, 2023
@memsharded memsharded added this to the 2.0.10 milestone Aug 7, 2023
@memsharded
Copy link
Member

Thanks for the report @db4

this is a bug, because every stacktrace is a bug, and it should be improved with a clear error message of what is happening.

The underlying cause is that creating packages without user but with channel is not allowed, and this will keep the same. The above should work if specified --user or not specified --channel

@db4
Copy link
Contributor Author

db4 commented Aug 7, 2023

@memsharded
A stacktrace on obviously incorrect options is not actually a serious problem, but what it does go to stdout instead of stderr is. (IMHO). Could you fix it as well?

@memsharded
Copy link
Member

Closed by #14444 and #14443, for next 2.0.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants