Bug
The get_latest_version() function in the install script hardcodes ukautz/scrut in the GitHub API URL:
get_latest_version() {
curl -fsSL --proto '=https' --tlsv1.2 \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/ukautz/scrut/releases/latest |
grep '"tag_name"' |
sed -r 's/^.*: *"(..*)",/\1/'
}
This ignores the SCRUT_RELEASE_REPO environment variable (and the --owner-repo / -r CLI flag), which is respected in the download URL construction:
_url="https://github.com/${SCRUT_RELEASE_REPO}/releases/download/${_latest}/scrut-${_latest}-${_os}-${_arch}.tar.gz"
Impact
Setting SCRUT_RELEASE_REPO=facebookincubator/scrut causes a version mismatch:
get_latest_version() queries ukautz/scrut, returning v0.2.3+docker1744130591
- The download URL targets
facebookincubator/scrut with that tag
- That tag does not exist on
facebookincubator/scrut (latest is v0.4.3), resulting in a 403 error
Even without setting SCRUT_RELEASE_REPO, the default (ukautz/scrut) hits the same problem because the + in the tag v0.2.3+docker1744130591 breaks the download URL.
Suggested fix
Use SCRUT_RELEASE_REPO in get_latest_version():
get_latest_version() {
curl -fsSL --proto '=https' --tlsv1.2 \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/${SCRUT_RELEASE_REPO}/releases/latest" |
grep '"tag_name"' |
sed -r 's/^.*: *"(..*)",/\1/'
}
Reproduction
SCRUT_RELEASE_REPO=facebookincubator/scrut \
curl --proto '=https' --tlsv1.2 -sSf https://facebookincubator.github.io/scrut/install.sh | sh
Output:
INFO: Detected OS/architecture: macos/aarch64
curl: (56) The requested URL returned error: 403