Skip to content

Commit 8c639d3

Browse files
committed
Rollup merge of #22420 - posixphreak:fix-rustup-locale, r=brson
Since `tr` converts lowercase to uppercase according to system locale using `LC_CTYPE` environment variable; on some locales, rustup.sh fails to use correct variables names, thus deletes temporarily downloaded files and gives a meaningless error as shown below. This a simple fix which explictly sets `LC_CTYPE` as `C`. Here is what happens without the fix: ``` ➜ projects curl -s https://static.rust-lang.org/rustup.sh | sudo sh rustup: CFG_CURL := /usr/bin/curl (7.22.0) rustup: CFG_TAR := /bin/tar (1.26) rustup: CFG_FILE := /usr/bin/file (5.09) rustup: CFG_SHA256SUM := /usr/bin/sha256sum (256sum) rustup: CFG_SHASUM := /usr/bin/shasum (5.61) rustup: rustup: processing sh args rustup: rustup: CFG_PREFiX := rustup: CFG_DATE := rustup: rustup: validating sh args rustup: rustup: host triple: i686-unknown-linux-gnu rustup: Downloading https://static.rust-lang.org/dist/rust-nightly-i686-unknown-linux-gnu.tar.gz to /tmp/tmp.Wz6F1ToG5z/rust-nightly-i686-unknown-linux-gnu.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 132M 100 132M 0 0 59947 0 0:38:31 0:38:31 --:--:-- 71204 rustup: Downloading https://static.rust-lang.org/dist/rust-nightly-i686-unknown-linux-gnu.tar.gz.sha256 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 109 100 109 0 0 107 0 0:00:01 0:00:01 --:--:-- 169 rustup: Verifying hash rustup: Extracting /tmp/tmp.Wz6F1ToG5z/rust-nightly-i686-unknown-linux-gnu.tar.gz install: looking for install programs install: install: found mkdir install: found printf install: found cut install: found grep install: found uname install: found tr install: found sed install: found chmod install: install: processing /tmp/tmp.Wz6F1ToG5z/rust-nightly-i686-unknown-linux-gnu/install.sh args install: install: CFG_DESTDiR := install: CFG_PREFiX := /usr/local install: CFG_LiBDiR := /lib install: CFG_MANDiR := /share/man install: install: validating /tmp/tmp.Wz6F1ToG5z/rust-nightly-i686-unknown-linux-gnu/install.sh args install: install: verifying platform can run binaries install: verifying destination is writable mkdir: cannot create directory `': No such file or directory install: error: can't write to destination. consider `sudo`. rustup: error: failed to install Rust ``` Notice how `i` wasn't replaced with `I`. Rust is installed as usual after the fix. Tested on Ubuntu x86 12.04 LTS. I'm not exactly sure if setting LC_CTYPE is the best solution, but there's that.
2 parents bc48107 + c24f353 commit 8c639d3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/etc/rustup.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ create_tmp_dir() {
241241
echo $TMP_DIR
242242
}
243243

244+
# Make `tr` locale independent
245+
LC_CTYPE=C
246+
244247
probe_need CFG_CURL curl
245248
probe_need CFG_TAR tar
246249
probe_need CFG_FILE file

0 commit comments

Comments
 (0)