Skip to content

fix(build): portable awk header matching and correct stderr redirects#453

Merged
ilysenko merged 1 commit into
ilysenko:mainfrom
ryan-mt:fix/build-ci-plumbing
Jun 11, 2026
Merged

fix(build): portable awk header matching and correct stderr redirects#453
ilysenko merged 1 commit into
ilysenko:mainfrom
ryan-mt:fix/build-ci-plumbing

Conversation

@ryan-mt

@ryan-mt ryan-mt commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

What changed

Two small build/CI plumbing fixes.

  1. Upstream DMG metadata capture silently degraded to unknown under mawk. capture_upstream_metadata in scripts/ci/container-entrypoint.sh and the equivalent step in .github/workflows/upstream-build-app.yml matched HTTP response headers with awk 'BEGIN{IGNORECASE=1} /^last-modified:/ ...'. IGNORECASE is a gawk extension; under mawk — the default awk in the ubuntu:24.04 CI container and on ubuntu runners — it is an inert variable, and real responses send capitalized Last-Modified / ETag / Content-Length, so all three lookups returned empty and the recorded metadata fell back to unknown / no-etag. Now matches on tolower($0), like the equivalent parser in scripts/lib/dmg.sh.

    Verified against real mawk:

    mawk old IGNORECASE etag: []
    mawk new tolower etag:    [abc]
    
  2. 2>&1 >&2 in scripts/lib/native-modules.sh did the opposite of intent. Redirections apply left to right: 2>&1 points stderr at current stdout, then >&2 points stdout at the (already-redirected) stderr — net effect, stderr merges into stdout and stdout is unchanged. The evident intent (keep npm/electron-rebuild chatter on stderr, the convention everywhere else in the install pipeline) is >&2.

Source-of-truth files

  • scripts/ci/container-entrypoint.sh
  • .github/workflows/upstream-build-app.yml
  • scripts/lib/native-modules.sh

Validation

  • bash -n across install/lib/launcher/build/ci scripts — clean
  • bash tests/scripts_smoke.sh on this branch in Ubuntu (WSL): All script smoke tests passed
  • mawk comparison above run against mawk 1.3.4 on Ubuntu (WSL)

Notes / limitations

  • Impact of (1) is limited to CI metadata/reporting (cache keys still work since they hash whatever values were captured); (2) is stream classification only — no caller currently parses install.sh stdout.

1. capture_upstream_metadata (container entrypoint) and the equivalent
   step in upstream-build-app.yml matched HTTP headers with
   `BEGIN{IGNORECASE=1}`, a gawk extension that is an inert variable
   under mawk - the default awk in the ubuntu:24.04 CI container and on
   ubuntu runners. Real responses send capitalized Last-Modified / ETag
   / Content-Length, so the recorded upstream DMG metadata silently
   degraded to "unknown" / "no-etag". Match on tolower($0) instead,
   like the equivalent parser in scripts/lib/dmg.sh.

2. native-modules.sh used `2>&1 >&2` on the npm install and
   electron-rebuild steps. Redirections apply left to right, so this
   merges stderr into stdout and leaves stdout where it was - the
   inverse of the intended "keep build chatter on stderr" convention
   used everywhere else in the install pipeline. Use `>&2`.

@ilysenko ilysenko left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed. No blocking issues found; CI is green and the build/CI portability fixes are scoped and safe.

@ilysenko ilysenko merged commit ddf1466 into ilysenko:main Jun 11, 2026
6 checks passed
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.

2 participants