New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fish autocomplete sometimes forgets history and goes back in time #10300
Comments
Is this on NFS? |
It's not NFS, no. There is currently no file in What does |
It incorporates new history from other, newer shells; the crucial side effect is that it will reload the history file. |
Okay two updates:
Any ideas what is causing the shell to get into this state in the first place? There is no network file system involved, and it's not like it starts with bad history; it just becomes bad eventually. |
What does your system clock say, i.e. |
The missing commands are from the current shell, right? Or from previous shells? (Probably not both) |
Definitely from previous shells; these are commands I run every day and have done so for years. I think they usually were probably also run in the current shell before they were forgotten, but I'm less sure about that.
|
This is a really mysterious bug, thanks for taking the effort to report. Maybe there's a simple explanation like you set When we create a history, or run Maybe there is some memory corruption that stomps the timestamp, setting it to some time in the past. That would explain why fish suddendly starts ignoring those. We probably need to add some logging. Can't hurt to try latest Git master as well, although I don't expect a change. |
Thanks for being attentive to my weird bug. :-) If you want to add some logging and tell me how to check it, I'd be more than happy to report back. There was one other theory I had, as someone who doesn't know fish's internals. How well is the plain text history format able to "re-synchronize" after corruption? Like if a line gets deleted or messed up or duplicated or something, are all of the entries after that liable to not work correctly? Or does it re-synchronize by looking for some marker afterward? I have in the past manually deleted entries from the file, and I worry if the format isn't robust it may have left me with a persistent problem if I made any editing mistakes. |
Running with |
Thanks, can you help me understand what that does? Will there be debug output somewhere that I can examine, and what am I looking for? |
Yes, there will be debug output. By default it'll go to the terminal, add I don't think we currently know anything specific to be looking for. |
I just wanted to mention I have the exact same symptoms. |
Alright, some non-exhaustive ideas:
|
I'm also affected and can add that I relatively often delete items from the history ( Edit: Also, I use tmux, so I do have multiple fish processes running. Maybe that in combination with deleting items?
I'll try to think about that the next times it happens.
Never noticed issues with my system clock.
I do use fzf integration and have two aliases to work with the history.
Yes
Both no
Didn't try that, would have to change my config. |
I also sometimes delete stuff from my history, just thought i'd mention it.
I'll report back the next time it happens.
Never noticed any issues.
Yes:
I use a couple of plugins:
sponge and fzf.fish are the history related ones.
Yes it does.
No.
Yes I do.
I have fish as my system shell in NixOS. |
I have this happen as well, it seems to take quite a while. I opened a terminal with debug history, and just let it sit there. The next day, I checked the history in that terminal and it forgot several commands, all of which are commands I ran in other terminals while that one was open. Checking the fish_history file, there's only one entry for each of the missing commands, and they have timestamps of when when I most recently ran them.
My system time is correct
No configuration at all, completely default
I'm on 3.7.0 now, and I've experienced this for a long time.
Several, none of my commands were run while cd'd into one though.
Never
Not really.
|
Fish does not read the history from other sessions after startup unless you run |
I'm talking about old commands that were in the history, but I ran them again somewhere else after opening the test terminal |
I think I mentioned this bug to krobelus at some point (few years ago?) but did not report. FWIW it is also still happening for me, and I can confirm that the commands in question are 'old commands that were in the history' rather than items recently added by work in other presently-running instances of fish. List of details relating to questions asked thus far:
|
someone needs to look at the code and add relevant logs |
I've been increasingly encountering a problem like this one for the past few months. The last time it happened, I noticed there were embedded NUL bytes in fish_history. (screenshot included) $ fish --version
$ uname -srm
$ fisher list
$ tmux -V
$ wc --lines fish_history.BAD
|
@planet36 Maybe best to file a different bug for that, so as to avoid derailing this one? It seems like different symptoms (of course the cause could be related in the end). |
I'm using fish 3.6.4 with this configuration. Typically I run fish within tmux, with a few different tmux windows open at a time.
I find that a few times per day, fish seems to forget history for commands I run all of the time. For example, I run a command of this form many times per day:
Normally when I typ
fo
, fish will automatically complete the rest of it and I can press right, then enter, to run it. But a few times per day one instance of fish will totally forget it, and auto-complete a broken typo version I ran months ago:If I switch to other instances of fish running in other tmux windows, they don't have this problem: they still autocomplete correctly. If I close the tmux window and open a new one, the new instance of fish is fine. Even if I run
fish
to get a new sub-shell within the broken instance, it also uses the correct history. It's only the one busted instance of fish.To be clear, it's not just one command. This issue happens with several different commands that I run frequently, and it seems like when fish gets into this state it's all recent history that is lost, not just one command.
It's almost as if there is some in-memory circular buffer of history, and it eventually overflows when I run enough commands, and then fish is confused and thinks old history is current.
How can I debug this issue? Is there anything I can collect to help you understand it better?
The text was updated successfully, but these errors were encountered: