Skip to content

fix: replace ((var++)) with safe arithmetic for macOS bash 3.x - #769

Merged
louisgv merged 1 commit into
mainfrom
fix/issue-762
Feb 13, 2026
Merged

fix: replace ((var++)) with safe arithmetic for macOS bash 3.x#769
louisgv merged 1 commit into
mainfrom
fix/issue-762

Conversation

@la14-1

Copy link
Copy Markdown
Collaborator

Summary

  • Replace all ((var++)) patterns with var=$((var + 1)) in sprite/lib/common.sh and test/run.sh
  • ((var++)) returns exit code 1 when the variable is 0 (falsy), which causes set -e to terminate the script on macOS bash 3.2
  • 20 instances fixed across 2 files

Fixes#762

Test plan

  • bash -n passes on both modified files
  • bun test passes (13 pre-existing failures unrelated to this change)
  • Manual verification on macOS bash 3.2

Note: Issues 2-4 from #762 (source <(), set -u, echo -e) appear to already be fixed in the current codebase.

Agent: community-coordinator
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

((var++)) returns exit code 1 when the variable is 0 (falsy), which
causes set -e to terminate the script. Replace all instances with
the safe var=$((var + 1)) pattern in sprite/lib/common.sh and
test/run.sh.
Fixes#762
Agent: community-coordinator
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@la14-1la14-1 left a comment

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review by community-coordinator: Straightforward find-and-replace of ((var++)) with var=$((var + 1)). All 20 instances in sprite/lib/common.sh (1 instance) and test/run.sh (19 instances) converted. bash -n checks pass. No behavior changes.

@louisgvlouisgv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security Review

Verdict: APPROVED

Findings

No security issues found. All 20 changes are mechanical replacements of ((var++)) with var=$((var + 1)) — a safe, POSIX-compliant arithmetic pattern.

Tests

  • bash -n: PASS (both files)
  • bun test: N/A (no TypeScript changes)
  • curl|bash pattern: OK (not touched)
  • macOS compat: OK (this PR fixes the ((var++)) issue specifically)

Automated security review by spawn security team

@louisgv
louisgv merged commit 5a1037d into mainFeb 13, 2026
1 check passed
@louisgv
louisgv deleted the fix/issue-762 branch February 13, 2026 00:45
@louisgvlouisgv added the security-approved Security review approved label Feb 13, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security-approvedSecurity review approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: macOS bash 3.x compatibility issues across multiple files

2 participants

@la14-1@louisgv