From c0cb33d44b31c3db9d745fc46e0a710993abbeba Mon Sep 17 00:00:00 2001 From: Eric Curtin Date: Thu, 22 Oct 2026 21:41:32 +0100 Subject: [PATCH 1/2] fix(install): silence awk escape warnings in RPM asset lookup Closes #4768 Signed-off-by: Eric Curtin --- install.sh | 20 +++++++------------- tasks/scripts/test-install-sh.sh | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/install.sh b/install.sh index 6440bff0fc..1ea8afe479 100755 --- a/install.sh +++ b/install.sh @@ -792,24 +792,18 @@ find_rpm_asset() { _package="$3" case "$_package" in - openshell) - _dev_name="openshell-dev-${_arch}.rpm" - _fallback_re="^openshell-[0-9].*\\.${_arch}\\.rpm$" - ;; - openshell-gateway) - _dev_name="openshell-gateway-dev-${_arch}.rpm" - _fallback_re="^openshell-gateway-[0-9].*\\.${_arch}\\.rpm$" - ;; - openshell-prover) - _dev_name="openshell-prover-dev-${_arch}.rpm" - _fallback_re="^openshell-prover-[0-9].*\\.${_arch}\\.rpm$" - ;; + openshell|openshell-gateway|openshell-prover) ;; *) error "unknown RPM package selector: ${_package}" ;; esac - awk -v dev_name="$_dev_name" -v fallback_re="$_fallback_re" ' + # Build the regex inside awk: -v values have their escapes processed. + awk -v package="$_package" -v arch="$_arch" ' + BEGIN { + dev_name = package "-dev-" arch ".rpm" + fallback_re = "^" package "-[0-9].*\\." arch "\\.rpm$" + } { name = $2 sub("^\\*", "", name) diff --git a/tasks/scripts/test-install-sh.sh b/tasks/scripts/test-install-sh.sh index 80ac03d2c6..8946fe6a5d 100755 --- a/tasks/scripts/test-install-sh.sh +++ b/tasks/scripts/test-install-sh.sh @@ -845,6 +845,24 @@ if [ "$(find_rpm_asset "${tmpdir}/checksums" x86_64 openshell-prover)" != "opens exit 1 fi +cat >"${tmpdir}/checksums" <<'EOF' +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa openshell-0.1.5-1xx86_64xrpm +bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb openshell-0.1.5-1.x86_64.rpm +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc openshell-gateway-0.1.5-1.x86_64.rpm +EOF + +rpm_err="${tmpdir}/rpm_err" +if [ "$(find_rpm_asset "${tmpdir}/checksums" x86_64 openshell 2>"$rpm_err")" != "openshell-0.1.5-1.x86_64.rpm" ] || + [ "$(find_rpm_asset "${tmpdir}/checksums" x86_64 openshell-gateway 2>>"$rpm_err")" != "openshell-gateway-0.1.5-1.x86_64.rpm" ]; then + echo "FAIL: RPM fallback must match a literal dot" >&2 + exit 1 +fi +if [ -s "$rpm_err" ]; then + echo "FAIL: RPM package selection must not print to stderr" >&2 + cat "$rpm_err" >&2 + exit 1 +fi + mock_gh_log="${tmpdir}/gh.log" PLATFORM=linux linux_package_method() { From 02f5afad95f53d45341f9d68411e6c2f63bf70ec Mon Sep 17 00:00:00 2001 From: Eric Curtin Date: Mon, 2 Nov 2026 21:34:30 +0000 Subject: [PATCH 2/2] test(install): run RPM asset lookup under gawk when present Signed-off-by: Eric Curtin --- tasks/scripts/test-install-sh.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tasks/scripts/test-install-sh.sh b/tasks/scripts/test-install-sh.sh index 8946fe6a5d..fb5c382c8e 100755 --- a/tasks/scripts/test-install-sh.sh +++ b/tasks/scripts/test-install-sh.sh @@ -851,9 +851,17 @@ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb openshell-0.1. cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc openshell-gateway-0.1.5-1.x86_64.rpm EOF +# gawk warns on bad regex escapes; mawk does not. Prefer gawk when present. +rpm_path="$PATH" +if gawk_bin="$(command -v gawk)"; then + mkdir "${tmpdir}/gawk-bin" + ln -s "$gawk_bin" "${tmpdir}/gawk-bin/awk" + rpm_path="${tmpdir}/gawk-bin:${PATH}" +fi + rpm_err="${tmpdir}/rpm_err" -if [ "$(find_rpm_asset "${tmpdir}/checksums" x86_64 openshell 2>"$rpm_err")" != "openshell-0.1.5-1.x86_64.rpm" ] || - [ "$(find_rpm_asset "${tmpdir}/checksums" x86_64 openshell-gateway 2>>"$rpm_err")" != "openshell-gateway-0.1.5-1.x86_64.rpm" ]; then +if [ "$(PATH="$rpm_path" find_rpm_asset "${tmpdir}/checksums" x86_64 openshell 2>"$rpm_err")" != "openshell-0.1.5-1.x86_64.rpm" ] || + [ "$(PATH="$rpm_path" find_rpm_asset "${tmpdir}/checksums" x86_64 openshell-gateway 2>>"$rpm_err")" != "openshell-gateway-0.1.5-1.x86_64.rpm" ]; then echo "FAIL: RPM fallback must match a literal dot" >&2 exit 1 fi