atuin: [Bug]: wrong item selected from history
What did you expect to happen?
macOS 15.4.1 and atuin 18.5.0
when I press ctrl+r to find history, select item from history wrong item is pasted to the command prompt.
Can’t always reproduce. Usually I do this quickly, ctrl+r, select what I need (by searching, etc) and press enter. Few times noticed, wrong command was pasted into prompt from history.
This happened on at least two occasions just today, which already drove me a bit crazy. When specifically tried, can’t reproduce.
What happened?
Wrong record was pasted into command prompt from history. let’s say I wanted to select line from history where I meant to rerun command to copy file, but instead rm -rf /path which I didn’t mean to delete was run.
Atuin doctor output
$ atuin doctor
Atuin Doctor
Checking for diagnostics
Please include the output below with any bug reports or issues
{
"atuin": {
"version": "18.5.0",
"sync": null,
"sqlite_version": "3.46.0"
},
"shell": {
"name": "zsh",
"default": "zsh",
"plugins": [
"atuin"
],
"preexec": "built-in"
},
"system": {
"os": "Darwin",
"arch": "arm64",
"version": "15.4.1",
"disks": [
{
"name": "REDACTED",
"filesystem": "apfs"
},
{
"name": "REDACTED",
"filesystem": "apfs"
},
{
"name": "REDACTED",
"filesystem": "apfs"
}
]
}
}
Code of Conduct
- I agree to follow this project’s Code of Conduct
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 19
- Comments: 53 (21 by maintainers)
18.6.0 stable is out now!
a pre-release is out with the fix:
https://github.com/atuinsh/atuin/releases/tag/18.6.0-beta.1
I hit the bug again, and tried #2715, and it seems to fix it. I did an
omz reload(from oh-my-zsh), so I don’t know if that might’ve fixed it separately since it’s a per-shell issue, but I’ll keep running that and see if it occurs again.@monyxie I got it fixed! I can no longer reproduce the bug! 🥳
Adding the
--root ~/.atuinto the install command worked.That’s the correct hash from my fork 👍🏻
@ellie Apologies for not realizing my binary wasn’t actually changed all this time! Looks like @monyxie and I are both confirmed cases of solving this bug with this very small patch: https://github.com/atuinsh/atuin/compare/main...curtisbelt-forks:atuin:zsh-select-bug (credit to @monyxie for figuring that out).
Thank you! That patch is included in #2715 (that I’ve been asking people to test 😅), so I’ll get that one merged. @BinaryMuse has been running it for a week now without the issue coming back.
Thanks for all the input everyone!
I’m able to 100% replicate this:
https://github.com/user-attachments/assets/ca13cd11-e93b-45e0-a322-fe512117a278
I also have the patch installed and encountered the issue again and then resolved it using
omz reloadso also confirming the patch is not resolving the issue.@ellie
atuin store rebuild historyworked for me and fixed the issue with the specific item that had trouble.Im on atuin 18.5.0 mac 15.4.1 zsh 5.9
The cargo command should show you the path to the
atuinbinary near the end of its output.You need to make sure that directory is in your PATH and precedes
~/.atuin/bin/.I did some more testing.
I then ran a bisect and it pointed to this commit. I was able to make the issue go away with this:
@curtisbelt im on plain zsh 5.9 not using oh my zsh.
Terminal is iterm2
After upgrading to build from #2706 and reloading omz don’t recall seeing this bug, also using Ghostty, but v 1.1.3.
@ellie I wish that was the case! I can rule that out completely as I’ve restarted my computer between installing the patch and seeing the bug.
For good measure I just ran this again:
which confirms it’s installed.
Thanks @curtisbelt! So far it does seem to be only zsh users, and potentially even omz. Does suggest that #2715 might resolve it. Are you able to test the patch?
To clarify my earlier comment regarding 18.4.0 – downgrading seems to prevent the issue from occurring on new entries, as devusb said, but it doesn’t seem to fix entries that are already broken, at least immediately.
will do. fwiw it feels like it just started recently (maybe with 18.5) – I hadn’t noticed it before this week, but seems like it’s like 2-3 times a day now in different contexts across different machines.
I’m having the same issue. My far fetched guess is that my multiple terminals are syncing, and then, the history in older terminals loses sync with history indexes.
When this issue happens to me I’m usually working on two different terminals side by side. After a while, the older terminal begins having the issue. Now, if I open a new terminal, the issue is gone.
I’ll post a video the next time it happens. Also, I’m going to try #2706.