Skip to content

fix(release): remove the installer's awk dependency - #332

Open
lit26 wants to merge 1 commit into
stepfun-ai:mainfrom
lit26:fix/149-install-sh-no-awk
Open

lit26 wants to merge 1 commit into
stepfun-ai:mainfrom
lit26:fix/149-install-sh-no-awk

Conversation

@lit26

@lit26 lit26 commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Fixes #149.

infra/release/install.sh used awk in four places: the release-manifest readers (json_value, json_top_value), the GitHub tag_name fallback used by the managed search tools, the sha256 digest trim, and the # stepcode PATH-block validator/stripper. The README lists no awk prerequisite, and a Fedora 44 WSL image without any awk implementation failed at manifest parsing:

bash: line 33: awk: command not found

Change

release-bundle.mjs writes latest.json and manifest.json with JSON.stringify(_, null, 2), so both documents are line-oriented — one top-level key per line, one entry per line inside each object. That shape is now read with bash pattern matching instead of awk:

  • json_top_value / json_value keep their exact signatures and semantics (section start, closing brace at end of section, first matching key wins).
  • The digest comes from a parameter expansion, ${actual%%[[:space:]]*}, instead of awk '{print $1}'.
  • strip_step_block is rewritten as two bash loops with the same behaviour: a nested or unterminated # stepcode marker leaves the rc untouched, the blank lines directly above a well-formed block are dropped with it, and an unterminated block's lines are restored rather than dropped.

Manifest entries with a missing key still fall through to the existing die messages (|| true keeps set -e from aborting before them).

Tests

New case in scripts/release-bundle.test.mjs: renders the installer against a fake release directory (file:// base URL, tar.gz with a stub step), builds a PATH containing every command the installer needs except awk, asserts awk is not reachable, then runs a full install and a checksum-mismatch run.

node --test scripts/release-bundle.test.mjs
# tests 19  # pass 16  # fail 0  # skipped 3   (skips are the pwsh cases)

The new case fails on the previous implementation (awk: command not found → exit 127, nothing installed). The existing strip_step_block harness and the static PATH-persistence checks still pass, and bash -n infra/release/install.sh is clean.

A CHANGELOG.md entry is added under Unreleased → Fixed.

install.sh read release-manifest fields, the GitHub tag_name fallback, the
sha256 digest, and the # stepcode PATH block through awk. A base system
with no awk implementation (a minimal Fedora/WSL image was reported in
stepfun-ai#149) therefore failed at manifest parsing, and the README lists no awk
prerequisite.

The release bundle writes latest.json and manifest.json with
JSON.stringify(_, null, 2), so one top-level key or entry object key per
line: read them with bash pattern matching instead. Trim the digest with
a parameter expansion, and rewrite strip_step_block's validator and
stripper as bash loops with the same semantics — nested or unterminated
markers still leave the rc untouched, and the blank lines directly above
a block are still dropped with it.

Add an end-to-end regression test that renders the installer against a
fake release directory and runs it with a PATH containing every command
it needs except awk, then proves a wrong checksum still aborts before
anything is installed. It fails on the previous implementation.

Refs stepfun-ai#149
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

install.sh fails when awk is not installed

1 participant