rust-lang / rustlings

:crab: Small exercises to get you used to reading and writing Rust code!
https://rustlings.cool
MIT License
52.75k stars 10.02k forks source link

rust/cargo checks appear to be broken #135

Closed bhearsum closed 5 years ago

bhearsum commented 5 years ago

I just tried to install rustlings and it reported success finding rustc/cargo, but there were errors shown:

~ curl -L https://git.io/rustlings | bash -s usr    
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100  2518  100  2518    0     0   1688      0  0:00:01  0:00:01 --:--:--  1688
Let's get you set up with Rustlings!
Checking requirements...
SUCCESS: Git is installed
bash: line 15: rustc: command not found
SUCCESS: Rust is installed
bash: line 24: cargo: command not found
SUCCESS: Cargo is installed
bash: line 73: rustc: command not found
SUCCESS: Rust is up to date
Cloning Rustlings at usr...
fatal: destination path 'usr' already exists and is not an empty directory.
Checking out version 1.1.0...
fatal: not a git repository (or any of the parent directories): .git
Installing the 'rustlings' executable...
bash: line 95: cargo: command not found
bash: line 97: rustlings: command not found
All done! Run 'rustlings' to get started.

I tried the check by hand, which actually showed different output entirely:

$ if [ -x "$(rustc)" ]; then echo "found"; fi

Command 'rustc' not found, but can be installed with:

sudo apt install rustc

bhearsum@voot:~/tmp$ echo $?
0

Which makes me wonder if it's something to do with Ubuntu's command suggestions?

komaeda commented 5 years ago

i believe we've had the same kind of issue in #118, it could be that it's some kind of nonstandard command suggestion. i've wanted to replace the [ -x "$(rustc)" ] check with [ -x "$(command -v rustc)" ] anyways, but i'm not completely sure on whether that would fix this particular case

bhearsum commented 5 years ago

It looks like it works on my system, for what it's worth:

bhearsum@voot:~/usr/rustlings$ head -n15 install.sh 
#!/usr/bin/env bash

echo "Let's get you set up with Rustlings!"

echo "Checking requirements..."
if [ -x "$(git)" ]
then
    echo "WARNING: Git does not seem to be installed."
    echo "Please download Git using your package manager or over https://git-scm.com/!"
    exit 1
else
    echo "SUCCESS: Git is installed"
fi

if [ -x "$(command -v rustc)" ]
bhearsum@voot:~/usr/rustlings$ bash install.sh foo
Let's get you set up with Rustlings!
Checking requirements...
SUCCESS: Git is installed
WARNING: Rust does not seem to be installed.
Please download Rust using https://rustup.rs!
komaeda commented 5 years ago

this should theoretically be closed in 1b3469f!