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

new tests fail on Windows if you have ~/.cargo/config #4601

Closed
ehuss opened this issue Oct 10, 2017 · 0 comments · Fixed by #4630
Closed

new tests fail on Windows if you have ~/.cargo/config #4601

ehuss opened this issue Oct 10, 2017 · 0 comments · Fixed by #4630
Labels
A-cargo-api Area: cargo-the-library API and internal code issues A-testing-cargo-itself Area: cargo's tests C-bug Category: bug O-windows OS: Windows

Comments

@ehuss
Copy link
Contributor

ehuss commented Oct 10, 2017

If you have a %USERPROFILE%\.cargo\config on Windows with name/email configured, this will be inadvertently picked up in the new test. The test assumes that TempDir is created in a "safe" location, but on Windows this is typically %USERPROFILE%\AppData\Local\Temp. The recursive tree walk will end up picking up the config file.

I don't have any ideas on how to fix this (other than avoiding using ~/.cargo/config). I don't see a way to prevent cargo from walking up the tree, and I don't know of an alternate way to get a temp directory outside of the user's home directory. I'd be happy with just adding a note somewhere (CONTRIBUTING.md?) to alert any potential Windows contributors.

Reproducing

  1. Create a file %USERPROFILE%\.cargo\config with these contents:
[cargo-new]
name = "Example"
email = "user@example.com"
  1. Run cargo test --test new

Current Behavior

The following tests fail:

test finds_author_priority ... FAILED
test finds_author_email ... FAILED
test finds_author_user ... FAILED
test finds_git_author ... FAILED
test finds_author_username ... FAILED
test finds_author_user_escaped ... FAILED
test finds_git_email ... FAILED
@carols10cents carols10cents added A-cargo-api Area: cargo-the-library API and internal code issues C-bug Category: bug A-testing-cargo-itself Area: cargo's tests O-windows OS: Windows labels Oct 16, 2017
ehuss added a commit to ehuss/cargo that referenced this issue Oct 16, 2017
Fixes rust-lang#4601.  By relying on `__CARGO_TEST_ROOT`, using a temp directory is no
longer necessary.
bors added a commit that referenced this issue Oct 17, 2017
Fix `new` tests on Windows inadvertently picking up ~/.cargo/config.

Fixes #4601.  By relying on `__CARGO_TEST_ROOT`, using a temp directory is no
longer necessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cargo-api Area: cargo-the-library API and internal code issues A-testing-cargo-itself Area: cargo's tests C-bug Category: bug O-windows OS: Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants