Skip to content

rustup-init fails when it is a relative symlink. #1512

@reitermarkus

Description

@reitermarkus

When installing rustup-init 0.14.0 with Homebrew, it fails because it is a relative symlink.

Environment:

$ which rustup-init
/usr/local/bin/rustup-init
$ readlink /usr/local/bin/rustup-init
../Cellar/rustup-init/1.14.0/bin/rustup-init
CARGO_HOME=~/.config/cargo
RUSTUP_HOME=~/.config/rustup

Here is what happens:

$ rm -rf ~/.config/rustup/ ~/.config/cargo/
$ rustup-init -y --no-modify-path
error: failed to set permissions for '~/.config/cargo/bin/rustup'
info: caused by: No such file or directory (os error 2)

After this, rustup is a symlink pointing to the same target as the original symlink, which is wrong.

$ readlink ~/.config/cargo/bin/rustup
../Cellar/rustup-init/1.14.0/bin/rustup-init

If I run the command again, it now tries to symlink from the wrong symlink again.

$ rustup-init -y --no-modify-path
error: could not create link from '../Cellar/rustup-init/1.14.0/bin/rustup-init' to '~/.config/cargo/bin/rustup'
info: caused by: File exists (os error 17)

This is probably an error in utils::current_exe() since it doesn't resolve the path correctly (or at all).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions