Skip to content

format.sh: fix yamlfmt checksum check on macOS - #8642

Draft
y9v wants to merge 1 commit into
mainfrom
fix/format-sh-macos-sha256sum
Draft

y9v wants to merge 1 commit into
mainfrom
fix/format-sh-macos-sha256sum

Conversation

@y9v

@y9v y9v commented Nov 23, 2026

Copy link
Copy Markdown
Member

Motivation

On recent macOS, /sbin/sha256sum is a BSD tool that rejects --strict (usage: sha256sum [-bctwz] [files ...]). Because format.sh used sha256sum --check --strict whenever sha256sum was on PATH, the yamlfmt download was never validated or extracted, and ./format.sh exited 1.

Changes

Only use sha256sum when it is GNU coreutils (sha256sum --version mentions GNU). Otherwise fall back to the existing shasum -a 256 --check --strict branch. BSD sha256sum also answers --version, so checking only the exit code is not enough.

Verification

  • macOS (Darwin 27, /sbin/sha256sum first on PATH, no shim): ./format.sh downloads yamlfmt, the checksum shows OK, and the script ends with "All good".
  • Linux (ubuntu:24.04): the GNU branch is selected and sha256sum --check --strict passes.
  • shellcheck: no new findings compared with main.

🤖 Generated with Claude Code

Recent macOS ships a BSD /sbin/sha256sum that rejects --strict, so the
yamlfmt download check failed and ./format.sh exited 1. Only use sha256sum
when it is GNU coreutils, and fall back to shasum -a 256 otherwise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

format.sh                                                               @DataDog/system-tests-core

This branch has not been deployed

No deployments
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.

1 participant