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

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.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 21
  • Comments: 16 (6 by maintainers)

Commits related to this issue

Most upvoted comments

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

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!

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.