-
Notifications
You must be signed in to change notification settings - Fork 89
fix(modules/anomaly/tmux): fix config handling in run scripts #629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The previous implementation using inline variable assignment and printf
caused issues with custom tmux configs containing special characters:
1. `TMUX_CONFIG="${TMUX_CONFIG}"` - Terraform's templatefile substitutes
the multi-line config inline, causing bash to interpret tmux commands
(like `set -g`, `bind C-s`) as shell commands.
2. `printf "$TMUX_CONFIG"` - The `%` character in tmux's default
horizontal split keybind (`bind %`) is interpreted as a printf format
specifier, corrupting the output.
Changes:
- Use heredoc with `read -r -d ''` for safe variable assignment
- Use `cat <<<` instead of `printf` for output
- Add `|| true` to handle read's non-zero exit on EOF
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes custom tmux configuration handling in the tmux module by addressing two critical bugs: shell command interpretation of tmux config directives (like set -g) and format specifier issues with % characters in tmux bindings (like bind %). The fix implements heredoc for variable assignment and here-string for output.
- Replaces direct variable assignment with heredoc to prevent bash from interpreting tmux configuration as shell commands
- Changes
printftocat <<<to avoid treating%characters in tmux config as format specifiers
075b283 to
48cd75d
Compare
35C4n0r
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @03kalven
LGTM !
Description
Fix custom tmux config handling. Two bugs:
TMUX_CONFIG="${TMUX_CONFIG}"- Terraform substitutes config inline, bash interpretsset -getc as shell commandsprintf "$TMUX_CONFIG"-%inbind %treated as format specifierType of Change
Module Information
Path:
registry/anomaly/modules/tmuxNew version: 1.0.4
Breaking change: [x] No
Testing & Validation
bun test)bun fmt)Related Issues
None