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

Overriding config through nested aliases does not work #13822

Open
DaniPopes opened this issue Apr 29, 2024 · 3 comments
Open

Overriding config through nested aliases does not work #13822

DaniPopes opened this issue Apr 29, 2024 · 3 comments
Labels
A-aliases Area: command aliases C-bug Category: bug S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. S-triage Status: This issue is waiting on initial triage.

Comments

@DaniPopes
Copy link

DaniPopes commented Apr 29, 2024

Problem

Passing --config ... inside of a cargo alias, and using that with another cargo alias does not work.

Steps

  1. cargo new test; cd test
  2. .cargo/config.toml
[alias]
my_alias = '--config build.rustflags=["--invalid"]'
  1. cargo my_alias c passes, but cargo my_alias check fails, indicating that the --config is not propagated through the c = check alias

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.79.0-nightly (c93926759 2024-04-23)
release: 1.79.0-nightly
commit-hash: c9392675917adc2edab269eea27c222b5359c637
commit-date: 2024-04-23
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Manjaro 23.1.4 (Vulcan) [64-bit]
@DaniPopes DaniPopes added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Apr 29, 2024
@heisen-li
Copy link
Contributor

@rustbot label +A-aliases

@rustbot rustbot added the A-aliases Area: command aliases label Apr 29, 2024
@epage
Copy link
Contributor

epage commented Apr 29, 2024

Currently, the context is loaded in two phases

  • GlobalContext::new at app start
  • GlobalContext::configure once the whole command-line has been parsed.

This would require us to add a third phase and correctly merge it in. The most likely to get wrong part is related to verbosity

@epage epage added C-enhancement Category: enhancement and removed C-bug Category: bug labels Apr 29, 2024
@weihanglo
Copy link
Member

This seems to be an unsupported behavior that is accidentally supported. From the [alias] doc:

The value may be an array of strings, where the first element is the command and the following are arguments. It may also be a string

We may need to figure out since when it started working, and consider either banning or officially supportting it.

@weihanglo weihanglo added C-bug Category: bug S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. and removed C-enhancement Category: enhancement labels May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-aliases Area: command aliases C-bug Category: bug S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

5 participants