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

rustup errors with a confusing message if run from a non-existing path #897

Closed
lu-zero opened this issue Jan 2, 2017 · 2 comments
Closed

Comments

@lu-zero
Copy link

lu-zero commented Jan 2, 2017

To reproduce:

# shell a
mkdir /tmp/testme
cd $_
# shell b
rm -fr /tmp/testme
# shell a
rustup
error: couldn't find value of CARGO_HOME
info: caused by: No such file or directory (os error 2)

from the strace I see that the getcwd failure is not managed.

@lu-zero
Copy link
Author

lu-zero commented Jan 2, 2017

mmap(NULL, 4190208, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f70d2501000
munmap(0x7f70d2501000, 1044480)         = 0
munmap(0x7f70d2800000, 1048576)         = 0
open("/sys/devices/system/cpu/online", O_RDONLY|O_CLOEXEC) = 3
read(3, "0-7\n", 8192)                  = 4
close(3)                                = 0
rt_sigaction(SIGPIPE, {SIG_IGN, [PIPE], SA_RESTORER|SA_RESTART, 0x7f70d2e3e3c0}, {SIG_DFL, [], 0}, 8) = 0
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f70d2400000
open("/proc/self/maps", O_RDONLY|O_CLOEXEC) = 3
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, "557b49762000-557b49d5c000 r-xp 0"..., 1024) = 1024
read(3, "64/libm-2.23.so\n7f70d2e0b000-7f7"..., 1024) = 1024
read(3, "ib64/libpthread-2.23.so\n7f70d33d"..., 1024) = 1024
read(3, "2.8\n7f70d39f0000-7f70d39f1000 rw"..., 1024) = 843
close(3)                                = 0
sched_getaffinity(9765, 32, [0 1 2 3 4 5 6 7]) = 8
mmap(0x7ffe644db000, 4096, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7ffe644db000
rt_sigaction(SIGSEGV, {0x557b49bd1d00, [], SA_RESTORER|SA_STACK|SA_SIGINFO, 0x7f70d33cbf70}, NULL, 8) = 0
rt_sigaction(SIGBUS, {0x557b49bd1d00, [], SA_RESTORER|SA_STACK|SA_SIGINFO, 0x7f70d33cbf70}, NULL, 8) = 0
sigaltstack(NULL, {ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=0}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f70d3c11000
sigaltstack({ss_sp=0x7f70d3c11000, ss_flags=0, ss_size=8192}, NULL) = 0
getcwd(0x7f70d242a000, 512)             = -1 ENOENT (No such file or directory)
getcwd(0x7f70d242a000, 512)             = -1 ENOENT (No such file or directory)

Some strace.

@lu-zero
Copy link
Author

lu-zero commented Jan 2, 2017

The problem is in src/rustup-utils/src/utils.rs in cargo_home()

    let cwd = try!(env::current_dir().chain_err(|| ErrorKind::CargoHome));
    let cargo_home = env_var.clone().map(|home| {
        cwd.join(home)
    });

It should not try to get cwd if cargo_home isn't set and even in that case not error out with that message.

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

No branches or pull requests

2 participants