Repository navigation
fix: drop malformed PATH entries before exporting them to terminals - #629
Merged
Merged
Conversation
The app's startup PATH and the CLI's tmux shim PATH now share one helper compiled into both targets. No behavior change.
An inherited PATH entry with invalid bytes decodes as U+FFFD and control characters, and Programa re-exports it to every new terminal and tmux shim. These tests fail until the PATH helper filters such entries.
An inherited PATH entry with invalid bytes decodes as U+FFFD, and Programa passed that text on to every new terminal and to the tmux shim PATH, so strict tools saw a corrupted PATH. The PATH helper now drops entries that carry U+FFFD or control characters, and the startup PATH is rewritten even when it already contains the bundled CLI directory.
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.
What this does
If the PATH Programa inherits has an entry with broken bytes in it, new terminals and the tmux shim no longer pass that entry on. Before, Programa turned the broken bytes into replacement characters and exported them, so tools that check PATH strictly saw a corrupted value in every new pane.
Summary
Ported by behavior from cmux
e36b8e8632(manaflow-ai/cmux#12057).Sources/TerminalPathEnvironment.swiftis new and compiled into both the app and the CLI. It holds the two PATH builders that used to live inline inTerminalSurface(startup PATH with the bundledbindirectory) andCLI+TmuxCompat(tmux shim PATH).bindirectory, but only if something was dropped. A clean PATH that already has it is still left alone, so its override behavior does not change.Review order: the refactor commit (no behavior change), then the test commit, then the fix.
Test Plan
./scripts/reload.sh --tag inc-1281builds the app and CLI.swiftcagainst the same cases as the tests: 7 of 7 match.GhosttyTerminalStartupEnvironmentTests(programaTests/GhosttyConfigTests.swift) pass; three of them fail on the test-only commit.Linear: INC-1281