Installing 1.15.0 from source fails in bootstrap.py · Issue #39469 · rust-lang/rust (original) (raw)

While updating the Gentoo package for rust to 1.15.0, I get this error:

Traceback (most recent call last): File "/var/tmp/portage/dev-lang/rust-1.15.0/work/rustc-1.15.0-src/src/bootstrap/bootstrap.py", line 491, in main() File "/var/tmp/portage/dev-lang/rust-1.15.0/work/rustc-1.15.0-src/src/bootstrap/bootstrap.py", line 440, in main if os.environ['USER'] != os.environ['SUDO_USER']: File "/usr/lib64/python2.7/UserDict.py", line 40, in getitem raise KeyError(key) KeyError: 'USER'

This appears to have been introduced as part of 0e272de, the commit that switched to rustbuild by default. I don't really get what the USER != SUDO_USER heuristic is intended to protect against, but it looks a bit fishy to me. For one thing, from this failure it would seem that it has not seen testing in very diverse environments, so using .get('USER') and .get('SUDO_USER') would probably make a lot more sense here. Second, while the goal appears to be to set enable_vendored_sources in some situations, this code is still executed when enable_vendored_sources is already set. Finally, there is a typo in the help text that is printed for this case ('intall').