Uh oh!
There was an error while loading. Please reload this page.
fix: replace ((var++)) with safe arithmetic for macOS bash 3.x - #769
Merged
Conversation
((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-1
commented
Feb 13, 2026
la14-1
left a comment
CollaboratorAuthor
There was a problem hiding this comment.
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.
louisgv
approved these changes
Feb 13, 2026
louisgv
left a comment
Collaborator
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
((var++))patterns withvar=$((var + 1))insprite/lib/common.shandtest/run.sh((var++))returns exit code 1 when the variable is 0 (falsy), which causesset -eto terminate the script on macOS bash 3.2Fixes#762
Test plan
bash -npasses on both modified filesbun testpasses (13 pre-existing failures unrelated to this change)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