fix: avoid tmux stdin path in paste_text (related to #118)#147
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates tmux paste buffer loading to use a temporary file rather than piping text via stdin to tmux load-buffer.
Changes:
- Write paste contents to a temp file and call
tmux load-bufferwith the file path - Add best-effort cleanup of the temp file after running
load-buffer - Introduce UTF-8 validation for temp file paths before passing them to tmux
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+378
to
+380
| let tmp_path = | ||
| std::env::temp_dir().join(format!("omar-paste-{}.txt", uuid::Uuid::new_v4())); | ||
| std::fs::write(&tmp_path, text).context("Failed to write paste text to temp file")?; |
Comment on lines
+381
to
+384
| let path_str = tmp_path | ||
| .to_str() | ||
| .context("Temp file path is not valid UTF-8")?; | ||
| let load_result = self.run(&["load-buffer", "-b", &buffer_name, path_str]); |
Comment on lines
+380
to
+386
| std::fs::write(&tmp_path, text).context("Failed to write paste text to temp file")?; | ||
| let path_str = tmp_path | ||
| .to_str() | ||
| .context("Temp file path is not valid UTF-8")?; | ||
| let load_result = self.run(&["load-buffer", "-b", &buffer_name, path_str]); | ||
| std::fs::remove_file(&tmp_path).ok(); // best-effort cleanup | ||
| load_result?; |
Contributor
Author
|
The /tmp permissions and temp-file creation safety concerns raised here are tracked in #146, which proposes a helper for secure temporary file creation across all three call sites. Cleanup on failure paths is also being considered via a RAII-based approach, but is intentionally out of scope for this PR. |
Owner
|
LGTM. Thanks for working on this! |
Merged
lsk567
added a commit
that referenced
this pull request
Jun 11, 2026
Bump OMAR version from 0.3.1 to 0.3.2 for release. Patch release — bug fixes and small enhancements since v0.3.1, no breaking changes: - fix: avoid tmux stdin path in paste_text (#147) - fix(mcp): strip "(deleted)" from server exe path so spawned agents get OMAR tools (#139) - fix: dashboard launch handoff (#137) - fix: smart event input capture / popup deferral for agent suggestions (#143, #133, #138) - fix(prompts): restore explicit agent cleanup duties lost in MCP migration (#132) - feat: swap gemini backend for agy (#142) - feat: add Codex reasoning effort to spawn_agent (#131) - docs/test/CI: CLAUDE.md karpathy template (#145), star-history images (#136), opencode session-name test alignment (#134) Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 free
to 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.
The crash report in #118 shows repeated tmux 3.2a server segfaults while hosting omar. After looking, it showed
load-buffer -(reading from piped stdin) inpaste_textas a potential candidate trigger. This PR avoids that code path by writing the payload to a temp file and passing the file path toload-bufferinstead, aligningpaste_textwith the existing temp-file approach already used insend_keys_literalfor large payloads.Also addresses the cleanup-on-error gap flagged by Copilot in #144: the temp file is now always deleted even if
load-bufferfails.This is a focused version of #144 with the
mpsc::unbounded_channelchange dropped per maintainer feedback.Closes #144. Related to #118.