From 5ddb623f41f4a649578e0574975967be83cbd6e2 Mon Sep 17 00:00:00 2001 From: "Sean T. Allen" Date: Tue, 14 Apr 2026 21:53:29 -0400 Subject: [PATCH] Write SHA-512 sibling in binary mode for cross-platform byte-identical output Python text mode on Windows translates '\n' to '\r\n' on write, which would yield CRLF-terminated siblings for Windows archives while Linux/macOS produce LF. Consumers byte-compare the file, so the asymmetry is a latent portability bug. Mirrors ponylang/ponyc#5233. --- .ci-scripts/release/github_release.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.ci-scripts/release/github_release.py b/.ci-scripts/release/github_release.py index 14477b8..6290472 100644 --- a/.ci-scripts/release/github_release.py +++ b/.ci-scripts/release/github_release.py @@ -90,8 +90,11 @@ def write_sha512_sibling(archive_path): for chunk in iter(lambda: f.read(1024 * 1024), b''): h.update(chunk) sibling_path = archive_path + '.sha512' - with open(sibling_path, 'w') as f: - f.write(h.hexdigest() + '\n') + # Binary mode: keep the digest file byte-identical across platforms. + # Text mode on Windows would rewrite '\n' as '\r\n' and produce Windows + # archives with CRLF-terminated siblings while Linux/macOS produce LF. + with open(sibling_path, 'wb') as f: + f.write((h.hexdigest() + '\n').encode('ascii')) return sibling_path