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

Step rustup default fails due to remains of prior build #127

Open
jberthold opened this issue Nov 18, 2024 · 0 comments
Open

Step rustup default fails due to remains of prior build #127

jberthold opened this issue Nov 18, 2024 · 0 comments

Comments

@jberthold
Copy link

One of our CI builds links and uses a custom toolchain which resides within the build artefacts.

This appears to persist between builds on the github runner, and makes a subsequent uses: dtolnay/rust-toolchain step fail during the rustup default step.

To reproduce what is happening:

build 1 creates a rust toolchain

jost@freshcode-1:/tmp/my-project$ mkdir -p broken/lib broken/bin && touch broken/bin/rustc
jost@freshcode-1:/tmp/my-project$ rustup toolchain link broken $PWD/broken

...and uses it as an override

jost@freshcode-1:/tmp/my-project$ rustup override set broken
info: override toolchain for '/tmp/my-project' set to 'broken'
jost@freshcode-1:/tmp/my-project$ rustup override list
/tmp/my-project                         	broken              
jost@freshcode-1:/tmp/my-project$ rustup toolchain list
stable-x86_64-unknown-linux-gnu (default)
nightly-x86_64-unknown-linux-gnu
broken (override)

build 1 finishes and its artefacts get removed

jost@freshcode-1:/tmp/my-project$ rm -rf broken/

but the override remains known and present in ~/.rustup

jost@freshcode-1:/tmp/my-project$ rustup toolchain list
stable-x86_64-unknown-linux-gnu (default)
nightly-x86_64-unknown-linux-gnu
broken
jost@freshcode-1:/tmp/my-project$ ll ~/.rustup/toolchains/
total 16
drwxrwxr-x 4 jost jost 4096 Nov 18 11:30 ./
drwxrwxr-x 6 jost jost 4096 Aug  7 17:24 ../
lrwxrwxrwx 1 jost jost   22 Nov 18 11:30 broken -> /tmp/my-project/broken
drwxrwxr-x 7 jost jost 4096 Aug 22 11:47 nightly-x86_64-unknown-linux-gnu/
drwxrwxr-x 7 jost jost 4096 Oct 17 12:53 stable-x86_64-unknown-linux-gnu/
jost@freshcode-1:/tmp/my-project$ rustup override list
/tmp/my-project                         	broken              

a subsequent build now tries to install rust

The github action calls rustup default which fails because of the broken toolchain

jost@freshcode-1:/tmp/my-project$ rustup default stable-x86_64-unknown-linux-gnu
info: using existing install for 'stable-x86_64-unknown-linux-gnu'
info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.81.0 (eeb90cda1 2024-09-04)

error: override toolchain 'broken' is not installed: the directory override for '/tmp/my-project' specifies an uninstalled toolchain

Interestingly, the rustup default command does succeed in setting or changing the default, it just returns an error afterwards.

My suggestion would be to protect the rustup default command and catch the error ( it probably needs testing that the desired toolchain is now default afterwards).

I am unsure whether this is a bug that should be reported to rustup instead, but making the github action more robust might be a good idea anyway.

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

No branches or pull requests

1 participant