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

Attempting to install rust with rustup-cli with $SHELL=zsh fails with assertion #1034

Closed
icefoxen opened this issue Apr 6, 2017 · 16 comments

Comments

@icefoxen
Copy link

icefoxen commented Apr 6, 2017

Message is thread 'main' panicked at 'assertion failed: (left == right)(left:2, right: 1)', src/rustup-cli/self_update.rs:495

The line in question seems to check that there is only one unix shell profile file in the list to be checked. But if the user's $SHELL is zsh, the list will contain both .profile and .zprofile and fail with an assertion error.

Setting the user's SHELL var to something non-zsh works around this problem temporarily.

@icefoxen icefoxen changed the title Attempting to run rustup-cli with $SHELL=zsh fails with assertion Attempting to install rust with rustup-cli with $SHELL=zsh fails with assertion Apr 6, 2017
@snowyu
Copy link

snowyu commented Apr 6, 2017

confirmed.

@mschmo
Copy link

mschmo commented Apr 6, 2017

Yeah, same issue for me. And here is the stack backtrace:

╰─$ echo $SHELL
/bin/zsh

╰─$ curl https://sh.rustup.rs -sSf | sh
info: downloading installer
thread 'main' panicked at 'assertion failed: `(left == right)` (left: `2`, right: `1`)', src/rustup-cli/self_update.rs:495
stack backtrace:
   1:        0x1079c320a - std::sys::imp::backtrace::tracing::imp::write::he3d1bfbdbf113480
   2:        0x1079cb24f - std::panicking::default_hook::{{closure}}::h575f1b40d2e88f07
   3:        0x1079c9edf - std::panicking::default_hook::h3d5dccce8125d0cf
   4:        0x1079ca516 - std::panicking::rust_panic_with_hook::h00b81bb3dcbd51f2
   5:        0x1079ca3b4 - std::panicking::begin_panic::ha6a0d553db9869ff
   6:        0x1079ca2d2 - std::panicking::begin_panic_fmt::h24d113aee3ee4081
   7:        0x1077bc8bf - rustup_init::self_update::install::h90ee439c9b6ab7e9
   8:        0x1077c9f4d - rustup_init::run_multirust::hcf1b092d2ea80abf
   9:        0x1077c8939 - rustup_init::main::h1a642123296d704d
  10:        0x1079cb80a - __rust_maybe_catch_panic
  11:        0x1079ca8b6 - std::rt::lang_start::h74b3afbdd8daef1c
rustup: command failed: /var/folders/2w/_gw1ybsn2m97nqltx84zvl9r0000gp/T/tmp.GHUQlujY/rustup-init

╰─$ export SHELL=/bin/bash

╰─$ curl https://sh.rustup.rs -sSf | sh
info: downloading installer

Welcome to Rust!

@RobGThai
Copy link

RobGThai commented Apr 7, 2017

How do you change Shell? I tried SHELL=/bin/bash curl https://sh.rustup.rs -sSf | sh but without success. I'm using ZSH by default so I'm not quite sure how to switch back to Bash any more.

@bjackson
Copy link

bjackson commented Apr 7, 2017

What worked for me was setting SHELL=/bin/bash and then manually running the rustup-init command.

@RobGThai
Copy link

RobGThai commented Apr 7, 2017

Got it working by downloaded shell file and run them locally. First day with Rust here. Appreciate the help 👍 .

@sirnuke
Copy link

sirnuke commented Apr 7, 2017

Happening for me as well. Downloading the script and running it with --no-modify-path allows installation to proceed.

$ echo $SHELL
/bin/zsh
$ ~/rustup.sh --version
info: downloading installer
rustup-init 1.1.0 (04fda5e 2017-04-04)

@smackysnacks
Copy link

There are numerous paths rustup can take to solve this issue:

  • Rustup enumerates available shells on the system and allows users to select/deselect a set of configs to append to.
  • Rustup enumerates available shells and appends to the config of each of them.
  • Rustup only appends to the .profile config.
  • Rustup only appends to the config of the running shell, falling back to .profile if the shell is unknown by rustup.
  • Rustup appends to both .profile and to the config of the running shell.

My vote goes to appending to the config of the running shell or .profile when that shell is unknown.

@steveklabnik
Copy link
Member

We are seeing this a lot in #rust-beginners.

@smackysnacks
Copy link

Temporary fix is curl https://sh.rustup.rs -sSf | SHELL=/bin/bash sh

@smackysnacks
Copy link

I'm willing to work on a PR if someone will describe the expected behavior.

@brson
Copy link
Contributor

brson commented Apr 8, 2017

@rmbreak Let's go with your instincts since you seem to know what's up. Will you make a patch?

@brson
Copy link
Contributor

brson commented Apr 8, 2017

@rmbreak actually, is there any harm in modifying both .profile and .zprofile? That's kind of what I intended. ISTM we can just delete this assertion and things should work.

@brson
Copy link
Contributor

brson commented Apr 8, 2017

Oh that assertion is because the message displays just one modified script. To remove the assertion we'd have to make the pre_install_message smarter.

@brson
Copy link
Contributor

brson commented Apr 8, 2017

I'm poking at a patch to remove that assertion, which I think is probably desirable regardless of whatever the ultimate strategy is.

@brson
Copy link
Contributor

brson commented Apr 8, 2017

Ok here's the patch. I intend to land that to fix the immediate problem and as a general improvement, but I'm open to further debate about the right way to handle PATH.

@rmbreak how do you feel about the maximal solution of modifying both .profile and .zprofile?

bors added a commit that referenced this issue Apr 8, 2017
Don't crash if modifying multiple profile files

Fixes #1034

cc @rmbreak
@smackysnacks
Copy link

@brson I think modifying .profile and the currently running shell's login config is fine.

If a system has sh, zsh, and csh installed with rustup running under a csh instance, then rustup should update .login and .profile, ignoring .zprofile.

When rustup gains support for other shells, such as csh, there will be different syntax for appending to PATH. In the case of csh: setenv PATH $HOME/.cargo/bin:$PATH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants