Skip to content

run-testbox: read the activity marker mtime with BSD stat on macOS - #17

Merged
aayushshah15 merged 1 commit into
mainfrom
aayushshah15/macos-portable-stat
Oct 24, 2026
Merged

aayushshah15 merged 1 commit into
mainfrom
aayushshah15/macos-portable-stat

Conversation

@aayushshah15

@aayushshah15 aayushshah15 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

The idle loop read the activity marker's mtime with GNU stat -c %Y. macOS ships BSD stat, which has no -c. Under the step's bash -e, the first check after blacksmith testbox run touches ~/.testbox-last-activity would exit the job and kill a macOS Testbox.

FILE_MTIME=$(stat -c %Y ~/.testbox-last-activity 2>/dev/null || stat -f %m ~/.testbox-last-activity)

ss is also missing on macOS. That check sits in an if condition, so it falls through to the marker file and doesn't abort the step. Reported in Pylon #15905.


View with [code]smith Prove this works
Need help on this PR? Tag @codesmith-bot with what you need.

Matches macOS idle loop survives marker read

With BSD-style stat and no ss, the old step dies with exit 1 at the first marker read. The new step reads the marker mtime through stat -f %m, keeps looping, and later shuts down normally on idle timeout with exit 0.

Merge-base

Before: step exits 1

This PR 0da87a25

After: loop continues

Also checked · 2 match

Matches Same epoch mtime on Linux GNU stat
Matches Missing ss falls through, no exit

Proof on 0da87a25


View with [code]smith View full Proof
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is enabled. (Staging)

Co-authored-by: Codesmith Staging <codesmith-bot@users.noreply.github.com>
@aayushshah15
aayushshah15 marked this pull request as ready for review October 24, 2026 16:28
@aayushshah15
aayushshah15 merged commit fc2c779 into main Oct 24, 2026
7 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.

1 participant