Harden bash and zsh prompt rendering#10
Draft
jdloft wants to merge 1 commit into
Draft
Conversation
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.
Motivation
%expansions in dynamic fields.toolbox) unreliable.Description
_dotfiles-bash-npto wrap ANSI color sequences with explicit readline non-printing delimiters (\001/\002) and applied it to the main prompt, exit-code, git, virtualenv, k8s and chroot segments insource/bash/20_prompt.bash._dotfiles-bash-npand updated_dotfiles-exit_code,_dotfiles-git-prompt,_dotfiles-virtualenv-prompt, and_dotfiles-k8s-promptto use the helper.host_namefromDOTFILES_HOST/HOSTNAME) instead of comparing the literal prompt escape token, and made the chroot prompt resilient to being read once.source/zsh/20_prompt.zshby switching to%~for the cwd and escaping%characters in dynamic fields (chroot, git branch, virtualenv, k8s context) to avoid percent-expansion and width miscalculation.Testing
bash -n source/bash/20_prompt.bashcompleted successfully with no syntax errors.zsh -n source/zsh/20_prompt.zshcould not be run in this environment becausezshis not installed, so Zsh syntax validation was not performed automatically.Codex Task