Repository navigation
fix: keep space-prefixed commands out of JSONL history (v2.0.3) - #11
Merged
Merged
Conversation
…exec bash-preexec, which `atuin init bash` loads, rewrites HISTCONTROL on the first prompt: it drops ignorespace and turns ignoreboth into ignoredups. From then on Bash's check_add_history accepts lines that start with a space, and flyline wrote them to the JSONL history. flyline now notes whether HISTCONTROL asked for ignorespace when the builtin loads and on each `flyline` command, and keeps skipping space-prefixed commands while bash-preexec is loaded. When the JSONL file is created from Bash's in-memory history, the command being recorded is no longer written twice, and space-prefixed entries are left out. Release v2.0.3. Co-Authored-By: Claude Opus 5.5 <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.
Problem
With
HISTCONTROL=ignorebothandeval "$(atuin init bash)", the JSONL history recorded commands typed with a leading space (" exit"," export TOKEN=…").bash-preexec, bundled in
atuin init bash, runs__bp_adjust_histcontrolon the first prompt. That stripsignorespaceand turnsignorebothintoignoredups, so in that sessionHISTCONTROLisignoredups::erasedups. From then on Bash'scheck_add_history, which flyline uses to decide what goes into the JSONL file, accepts space-prefixed lines.Fix
src/history/ignorespace.rs. flyline checks whetherHISTCONTROLasks forignorespaceat two points: when the builtin loads, and on everyflyline …command. In a normal.bashrcboth happen before bash-preexec's first prompt.bash_preexec_imported/__bp_imported), flyline keeps skipping space-prefixed commands, but only in the JSONL file. Bash's own history still gets the line, because bash-preexec reads it back withhistory 1.Testing
cargo test --lib: 913 passed. New unit tests cover the decision logic and the seed filtering.cargo fmt -- --check,cargo clippy --workspace --all-features -- -D warnings, and rustdoc with-D warningsare clean..bashrc(atuin, bash-preexec,HISTCONTROL=ignoreboth:erasedups), writing to a temporary JSONL path.echo secret3andexitwere recorded.echo publicandecho twoare recorded, each once.🤖 Generated with Claude Code