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

Checksum files for manual installation #3693

Closed
darthbanana13 opened this issue Mar 4, 2024 · 4 comments · Fixed by #3730
Closed

Checksum files for manual installation #3693

darthbanana13 opened this issue Mar 4, 2024 · 4 comments · Fixed by #3730
Assignees
Labels
Milestone

Comments

@darthbanana13
Copy link

Problem

If installation is attempted with the manual method, documented here: https://rust-lang.github.io/rustup/installation/other.html, a download tool with an automatic checksum verifier fails because the path for downloaded file has a path prepended.

Steps

For example with ansible:

Create a local hosts.yaml file:

dev:
  localhost:
    ansible_connection: local

Create a playbook.yaml:

- hosts: dev
  roles:
    - rustup

Create role directory.
In it use command: ansible-glalaxy init rustup
To create an empty role.

Edit main.yaml in tasks to:

---
- name: Download rustup-init
  ansible.builtin.get_url:
    url: "https://static.rust-lang.org/rustup/dist/armv7-unknown-linux-gnueabihf/rustup-init"
    dest: /tmp/rustup-init
    checksum: "sha256:https://static.rust-lang.org/rustup/dist/armv7-unknown-linux-gnueabihf/rustup-init.sha256"
    mode: "0555"

Run the playbook from the plabook file location:
ansible-playbook -i hosts.yaml bootstrap.pb.yaml

See error:
FAILED! => {"changed": false, "msg": "Unable to find a checksum for file 'rustup-init' in 'https://static.rust-lang.org/rustup/dist/armv7-unknown-linux-gnueabihf/rustup-init.sha256'"}

Possible Solution(s)

Use only the executable name in the sha256 file. Instead of:
f21c44b01678c645d8fbba1e55e4180a01ac5af2d38bcbd14aa665e0d96ed69a *target/armv7-unknown-linux-gnueabihf/release/rustup-init
use:
f21c44b01678c645d8fbba1e55e4180a01ac5af2d38bcbd14aa665e0d96ed69a ./rustup-init
or
f21c44b01678c645d8fbba1e55e4180a01ac5af2d38bcbd14aa665e0d96ed69a rustup-init

Examples of other projects doing it with only the executables in the sha file:
Neovim
Mise

Notes

No response

Rustup version

Rustup was not installed

Installed toolchains

Rustup was not installed
@rami3l
Copy link
Member

rami3l commented Mar 5, 2024

@darthbanana13 Thanks for filing this issue! This does look like an oversight.

Related code:

Get-FileHash .\target\${env:TARGET}\release\* | ForEach-Object {[io.file]::WriteAllText($_.Path + ".sha256", $_.Hash.ToLower() + "`n")}

if [ "$(uname -s)" = "Darwin" ]; then
find target/"$TARGET"/release/ -maxdepth 1 -type f -exec sh -c 'fn="$1"; shasum -a 256 -b "$fn" > "$fn".sha256' sh {} \;
else
find target/"$TARGET"/release/ -maxdepth 1 -type f -exec sh -c 'fn="$1"; sha256sum -b "$fn" > "$fn".sha256' sh {} \;
fi

@rust-lang/release Does our CI/CD somehow rely on the binary path in the shasum file?

@Mark-Simulacrum
Copy link
Member

I have no idea, and doubt anyone knows off hand. It's certainly plausible that downstream people consuming the file (if it's exposed) do though.

@rami3l rami3l self-assigned this Mar 12, 2024
@rami3l
Copy link
Member

rami3l commented Mar 12, 2024

... in this case I guess the best thing to do is to fix the error no matter what. A potential downstream relying on our error seems strange and definitely a thing to be fixed anyway.

@rami3l
Copy link
Member

rami3l commented Mar 22, 2024

I've sent the fix. Guess we'll know if it breaks anything when v1.27.1 lands :]

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

Successfully merging a pull request may close this issue.

3 participants