Skip to content

Fix silent script failure from ((var++)) with set -e - #328

Merged
CasJam merged 1 commit into
buildermethods:mainfrom
barefootcoder:fix/arithmetic-set-e-bug
May 5, 2026
Merged

Fix silent script failure from ((var++)) with set -e#328
CasJam merged 1 commit into
buildermethods:mainfrom
barefootcoder:fix/arithmetic-set-e-bug

Conversation

@barefootcoder

Copy link
Copy Markdown
Contributor

Summary

  • project-install.sh silently exits after printing "Configuration:" without installing anything
  • Root cause: bash ((var++)) returns exit status 1 when var is 0 (post-increment returns the old value), and set -e treats this as a fatal error
  • Fixed all standalone ((var++)) expressions across project-install.sh, common-functions.sh, and sync-to-profile.sh by appending || true

Steps to reproduce

cd /path/to/any/project
/path/to/agent-os/scripts/project-install.sh

Output stops at "Configuration:" and no files are installed.

Test plan

  • Verified project-install.sh now completes successfully and installs all 5 commands
  • Verify sync-to-profile.sh works with the same fix pattern

🤖 Generated with Claude Code

When a bash arithmetic expression ((var++)) is evaluated and var is 0,
the post-increment returns the old value (0), which bash treats as a
failure exit status. Combined with set -e, this silently kills the
script. This caused project-install.sh to exit immediately after
printing "Configuration:" without performing any installation.

Fix by appending `|| true` to all standalone ((var++)) expressions
so the zero-return doesn't trigger set -e.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@CasJam
CasJam merged commit b6f23b6 into buildermethods:main May 5, 2026
CasJam pushed a commit that referenced this pull request May 5, 2026
@CasJam

CasJam commented May 5, 2026

Copy link
Copy Markdown
Contributor

Merged. Thanks for the fix, @barefootcoder.

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.

2 participants