Skip to content

ci: retry pcre2/zlib/openssl downloads in build-windows - #389

Open
fzipi wants to merge 1 commit into
owasp-modsecurity:masterfrom
fzipi:fix/windows-tarball-download-flakiness
Open

ci: retry pcre2/zlib/openssl downloads in build-windows#389
fzipi wants to merge 1 commit into
owasp-modsecurity:masterfrom
fzipi:fix/windows-tarball-download-flakiness

Conversation

@fzipi

@fzipi fzipi commented Jul 28, 2026

Copy link
Copy Markdown

Summary

Fixes #388.

The build-windows job's "Set up third-party libraries" step piped wget directly into tar with no retry:

wget -q -O - https://.../pcre2-10.47.tar.gz | tar -xzf -

A single truncated download (gzip: stdin: unexpected end of file / tar: Child returned status 1) killed the whole job immediately, with -q hiding which of the three downloads actually failed.

  • Download to a file first (wget --tries=3 --retry-connrefused --waitretry=5 -O "$archive" "$url"), then extract, rather than piping straight into tar. This isn't just cosmetic: piping can't be retried safely in the first place — a retried request restarts the response from byte 0, but tar has already consumed whatever the first, truncated attempt streamed through the pipe. A retry there would just append a second copy of the file after the truncated first one, corrupting the archive instead of fixing anything. A file-based retry cleanly overwrites the previous attempt.
  • set -euo pipefail added explicitly at the top of the step, so any failure (including from wget itself) is fail-fast rather than silently continuing.

Test plan

  • shellcheck/shfmt clean on the extracted script.
  • actionlint/zizmor show no new findings versus the file's current state (the existing unpinned-action/artipacked/cmd-shell findings elsewhere in this file are pre-existing and out of scope for this fix).
  • CI: confirm build-windows gets past this step reliably. Note per Windows CI: flaky pcre2/zlib/openssl tarball download in test_new.yml's build-windows job #388's own writeup: this job also hits a separate, unrelated, deterministic failure further along (yajl/CMake CMP0026 incompatibility, tracked upstream as owasp-modsecurity/ModSecurity#3604), so build-windows won't go fully green until that's also fixed — this PR only addresses the flaky download this step itself is responsible for.

The "Set up third-party libraries" step piped wget directly into tar
with no retry, so a single truncated download (gzip: stdin: unexpected
end of file / tar: Child returned status 1) killed the whole job with
no indication of which of the three downloads failed.

Download to a file first, with wget's own retry flags, then extract
once the download is complete. Piping straight into tar can't be
retried safely: a retried request restarts the response from byte 0,
but tar has already consumed whatever the first, truncated attempt
sent through the pipe -- a retry would just append a second copy of
the file after the first truncated one, corrupting the archive rather
than fixing anything. A file-based retry cleanly overwrites the
previous attempt instead.

Fixes owasp-modsecurity#388

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

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.

Windows CI: flaky pcre2/zlib/openssl tarball download in test_new.yml's build-windows job

1 participant