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

config errors with alias may not be reported #11013

Closed
ehuss opened this issue Aug 21, 2022 · 0 comments · Fixed by #11087
Closed

config errors with alias may not be reported #11013

ehuss opened this issue Aug 21, 2022 · 0 comments · Fixed by #11087
Labels
A-aliases Area: command aliases A-configuration Area: cargo config files and env vars A-diagnostics Area: Error and warning messages generated by Cargo itself. C-bug Category: bug

Comments

@ehuss
Copy link
Contributor

ehuss commented Aug 21, 2022

Problem

If there is a syntax error in a .cargo/config file, and the user tries to run an alias command, there is no indication of why it failed to find the alias.

Steps

  1. Create a .cargo/config:

    [alias]
    foo = ["a" "b"]

    Notice the missing comma.

  2. Run cargo foo

  3. Observe the output:

    error: no such subcommand: `foo`
    
         Did you mean `doc`?
    

    At this point, it isn't immediately clear what went wrong.

Possible Solution(s)

If there is an error loading the config, and cargo is unable to find the command to run, then it should probably relay the config error to the user.

There may be other situations where it might be useful to relay the config error. For example, if I have an alias like clippy, and the config fails to load, cargo will go ahead and run clippy without the aliased arguments.

I'm not sure when and how it would be best to relay the information about the malformed config. It also may be difficult to plumb the error up to the alias-handling code.

Notes

No response

Version

cargo 1.65.0-nightly (9809f8ff3 2022-08-16)
@ehuss ehuss added C-bug Category: bug A-configuration Area: cargo config files and env vars A-diagnostics Area: Error and warning messages generated by Cargo itself. A-aliases Area: command aliases labels Aug 21, 2022
@bors bors closed this as completed in 247ca7f Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-aliases Area: command aliases A-configuration Area: cargo config files and env vars A-diagnostics Area: Error and warning messages generated by Cargo itself. C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant