Skip to content

test: the make env mode check reads GNU stat first, so it passes on Linux - #63

Merged
mauricios merged 1 commit into
mainfrom
fix/stat-mode-portability
Oct 9, 2026
Merged

mauricios merged 1 commit into
mainfrom
fix/stat-mode-portability

Conversation

@mauricios

Copy link
Copy Markdown
Contributor

Main's CI has been red since #61: the static job fails one module test, make env: creates .env from .env.example, readable only by its owner. That includes the v2.0.0 release commit (#62). macOS passes the test, so local runs stayed green.

Cause

The test read the mode with stat -f %Lp FILE 2>/dev/null || stat -c %a FILE, BSD's form first. GNU stat on Linux reads -f as "file system" and %Lp as a file name. It prints the file system's details for .env, exits non-zero on the missing %Lp, and the fallback then prints 600. The captured output is therefore several lines plus 600, never 600.

The Makefile template is correct: cp .env.example .env && chmod 600 .env. Only the test is wrong.

Fix

Read GNU's form first, then BSD's: stat -c %a FILE 2>/dev/null || stat -f %Lp FILE. BSD stat rejects -c and prints nothing to stdout, so the fallback gives 600 there. A comment above the check says why the order matters.

This is a test-only change, so it needs no changelog entry. The v2.0.0 tag still belongs on the release merge commit (4e62d44): this change ships nothing.

Checks

  • macOS: evals/static/test-modules.sh passes all 69 tests.
  • Linux: this PR's CI run is the check; this machine has no GNU stat.

🤖 Generated with Claude Code

…inux

The check ran `stat -f %Lp FILE || stat -c %a FILE`. GNU stat reads -f
as "file system" and %Lp as a file name: it prints the file system's
details, exits non-zero on the missing name, and the fallback adds
"600", so the output never equals 600. CI on Linux failed on it from
#61 on (89ca301, and the v2.0.0 release commit 4e62d44); macOS passed.
GNU's form first, then BSD's, gives 600 on both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mauricios
mauricios marked this pull request as ready for review October 9, 2026 19:29
@mauricios
mauricios merged commit d38f4ae into main Oct 9, 2026
1 check passed
@mauricios
mauricios deleted the fix/stat-mode-portability branch October 9, 2026 19:29
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