iffy / install-nim

Github Action to install Nim
MIT License
30 stars 1 forks source link

trying to install an unsupported binary silently installs a different binary #23

Closed ee7 closed 2 years ago

ee7 commented 2 years ago

Situation

Try to install Nim from binaries that iffy/install-nim does not yet include in nightlies.txt, like binary:1.6.6.

Current behavior

The binary for a different Nim version (here, 1.4.2) is silently installed:

$ install-nim.sh 'binary:1.6.6'
Install type: binary
       param: 1.6.6
install_binary 1.6.6
Found nightly URL for 1.6.6: https://github.com/nim-lang/nightlies/releases/tag/2020-11-30-version-1-4-3fb5157ab1b666a5a5c34efde0f357a82d433d04
Installing prebuilt binaries from: https://github.com/nim-lang/nightlies/releases/tag/2020-11-30-version-1-4-3fb5157ab1b666a5a5c34efde0f357a82d433d04
Archive pattern: linux_x64.tar.xz
tag=2020-11-30-version-1-4-3fb5157ab1b666a5a5c34efde0f357a82d433d04
archive_url=https://github.com/nim-lang/nightlies/releases/download/2020-11-30-version-1-4-3fb5157ab1b666a5a5c34efde0f357a82d433d04/nim-1.4.2-linux_x64.tar.xz
archive name: nim-1.4.2-linux_x64.tar.xz
Creating output dir...
Downloading https://github.com/nim-lang/nightlies/releases/download/2020-11-30-version-1-4-3fb5157ab1b666a5a5c34efde0f357a82d433d04/nim-1.4.2-linux_x64.tar.xz ...

Expected behavior

An error, saying something like:

Binary release for `1.6.6` was not found.
If that is a recent Nim version, it may not yet be supported by the installation script.
Otherwise, please check that the version number is correct.
iffy commented 2 years ago

Oh yikes. Let me figure out what's happening.

iffy commented 2 years ago

Found it. It's because the hash for 1.4.2 contains ...1b666... which matches the naive grep for 1.6.6.