rust-lang / rustup

The Rust toolchain installer
https://rust-lang.github.io/rustup/
Apache License 2.0
6.18k stars 893 forks source link

Undocumented environment variables? #3957

Open cher-nov opened 4 months ago

cher-nov commented 4 months ago

Problem you are trying to solve

https://rust-lang.github.io/rustup/environment-variables.html https://rust-lang.github.io/rustup/dev-guide/tips-and-tricks.html

After reading the rustup code a little (https://github.com/rust-lang/rust-forge/issues/760), I found out that not all the environment variables it supports are documented. A quick search using grep -rniI -e "var(" -e "env\!(" -e "env(" -e "var_os(" revealed at least these:

https://github.com/rust-lang/rustup/blob/edf5c22d478ecce60ae35e3d3a1ae5ff04c6bedb/src/cli/self_update/unix.rs#L21

https://github.com/rust-lang/rustup/blob/edf5c22d478ecce60ae35e3d3a1ae5ff04c6bedb/src/cli/self_update/windows.rs#L186

https://github.com/rust-lang/rustup/blob/edf5c22d478ecce60ae35e3d3a1ae5ff04c6bedb/src/cli/self_update.rs#L512

https://github.com/rust-lang/rustup/blob/edf5c22d478ecce60ae35e3d3a1ae5ff04c6bedb/src/cli/self_update.rs#L627

https://github.com/rust-lang/rustup/blob/edf5c22d478ecce60ae35e3d3a1ae5ff04c6bedb/src/dist/mod.rs#L368

https://github.com/rust-lang/rustup/blob/edf5c22d478ecce60ae35e3d3a1ae5ff04c6bedb/src/dist/mod.rs#L534

https://github.com/rust-lang/rustup/blob/edf5c22d478ecce60ae35e3d3a1ae5ff04c6bedb/src/dist/mod.rs#L660

https://github.com/rust-lang/rustup/blob/edf5c22d478ecce60ae35e3d3a1ae5ff04c6bedb/src/utils/utils.rs#L248

https://github.com/rust-lang/rustup/blob/edf5c22d478ecce60ae35e3d3a1ae5ff04c6bedb/src/config.rs#L274

https://github.com/rust-lang/rustup/blob/edf5c22d478ecce60ae35e3d3a1ae5ff04c6bedb/src/config.rs#L400

https://github.com/rust-lang/rustup/blob/edf5c22d478ecce60ae35e3d3a1ae5ff04c6bedb/src/toolchain.rs#L247

Solution you'd like

Describe all this somewhere and/or make a list of variables for internal use so as not to confuse people.

djc commented 4 months ago

You did not describe the "problem you are trying to solve". What is it? What are you confused about?

cher-nov commented 4 months ago

You did not describe the "problem you are trying to solve". What is it? What are you confused about?

Sorry, my English is far from perfect. The thing that confuses me is the support for these variables in the code and their absence in the official documentation. That's it.

djc commented 4 months ago

Right -- the question I'm asking is, what are you trying to achieve that you need to understand these variables?

cher-nov commented 4 months ago

Right -- the question I'm asking is, what are you trying to achieve that you need to understand these variables?

How to correctly access the staging manifests at least. I just noticed that RUSTUP_STAGED_MANIFEST is not the only undocumented variable, and decided to make a list of them so that Rust developers don’t have to bother with this. "It is my duty to report." (c)

djc commented 4 months ago

I'm not sure it makes sense to me to document a list of internal-only environment variables. I think most of these should probably remain internal and keeping those undocumented seems okay to me.