fix(hooks): replace BASH_SOURCE with POSIX-safe $0 for Linux compatibility#553
fix(hooks): replace BASH_SOURCE with POSIX-safe $0 for Linux compatibility#553
Conversation
…ibility This completes the fix started in v4.3.1 by addressing the same 'Bad substitution' issue in the session-start hook and documentation.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughUpdated path-resolution logic in hook scripts from Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@obra |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace ${BASH_SOURCE[0]:-$0} with $0 in hooks/session-start and the
polyglot-hooks docs example. BASH_SOURCE uses bash array syntax that
causes 'Bad substitution' on systems where /bin/sh is dash (Ubuntu).
Since session-start is always executed (never sourced), $0 and
BASH_SOURCE give the same result. Tested on Linux (bash + dash) and
Windows (Git Bash via CMD and direct).
Based on obra#553, closes obra#553.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This PR completes the Linux/Ubuntu compatibility fix started in v4.3.1.
While the shell wrapper was updated, the internal session-start hook script still used the ${BASH_SOURCE[0]} syntax, which causes a 'Bad substitution' error on systems where /bin/sh is dash (like Ubuntu).
Changes: