From 778004a06763e73d439ca440f6623fb72d71c10f Mon Sep 17 00:00:00 2001 From: Chris Fallin Date: Thu, 2 Nov 2023 11:56:16 -0700 Subject: [PATCH] install.sh: support compactified JSON from GitHub API. In bytecodealliance/wasmtime#7377, we saw a case where a user gets compactified (single-line) JSON responses from the GitHub API. The `install.sh` logic to get the latest Wasmtime release version currently does text-munging that assumes a multiline (pretty-printed) JSON layout. This PR instead uses `tr` and `sed` to get the version number from either input format (thanks to @bjorn3 for the exact invocations!). Fixes bytecodealliance/wasmtime#7377. --- install.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 6c8d14d..7d67e87 100644 --- a/install.sh +++ b/install.sh @@ -41,8 +41,9 @@ get_latest_release() { curl --silent "https://api.github.com/repos/bytecodealliance/wasmtime/releases/latest" | \ - grep tag_name | \ - cut -d '"' -f 4 + tr -d '\n' | \ + sed 's/.*tag_name": *"//' | \ + sed 's/".*//' } release_url() {