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

Cargo's testsuite can be confused by outside config files #9107

Closed
ehuss opened this issue Jan 28, 2021 · 1 comment · Fixed by #9164
Closed

Cargo's testsuite can be confused by outside config files #9107

ehuss opened this issue Jan 28, 2021 · 1 comment · Fixed by #9164
Labels
A-testing-cargo-itself Area: cargo's tests C-bug Category: bug

Comments

@ehuss
Copy link
Contributor

ehuss commented Jan 28, 2021

Problem
Adding a .cargo/config file to the root of the cargo source tree with the following contents:

[profile.dev]
debug = 0

will cause the config::profile_env_var_prefix test to fail.

This is because that test is building a Config object directly, instead of spawning a process, and thus the Config object will load all config files found in all parent directories. Normally there is an environment variable to prevent that, but it is not appropriate to set that in the test since it is global.

Possible Solution(s)

Uncertain how to fix this. Perhaps Config could be extended to set how far up the config search will go. Or the test could create a temp directory outside of the user's home directory, and set that as cwd. I think ideally this could be fixed whenever something like #7887 is implemented.

Notes

Latest on master: c3abcfe

@ehuss ehuss added C-bug Category: bug A-testing-cargo-itself Area: cargo's tests labels Jan 28, 2021
@Mark-Simulacrum
Copy link
Member

I'll just note that this also affects rustbuild, where we get bug reports from .cargo/config options set that conflict with those we manage internally. I'm not sure if the fix ought to target both (pretty different, I think) use cases though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testing-cargo-itself Area: cargo's tests C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants