Fish history not working; more specifically, not adding new entries
I don't really know exactly since when this happen. I think since I updated to Ubuntu 20.04.
I have used Fish since a long time, and earlier via Linuxbrew to get a more recent version.
So I assume this is some mixup of the configs or formats.
How do I debug this? I don't get any error. When I press up-arrow in a new shell, it will print me some very old entries (I don't remember from when, but some years old I think).
Strangely, even removing ~/.config/fish did not resolve this. It even still has the old history. I actually have no idea where it gets this history from...
1 Answer
Ok, strace helped me to debug this. I got already much more information. The only problem with strace is that it is way too verbose. Anyway, via strace -e file fish, I saw this:
...
stat("/home/az/.local/share/fish/fish_history", 0x7ffd4f2e4160) = -1 EACCES (Permission denied)
openat(AT_FDCWD, "/home/az/.config/fish/fish_history", O_RDONLY|O_CLOEXEC) = 6
unlink("/home/az/.local/share/fish/fish_history") = -1 EACCES (Permission denied)
openat(AT_FDCWD, "/home/az/.local/share/fish/fish_history", O_WRONLY|O_CREAT|O_CLOEXEC, 0644) = -1 EACCES (Permission denied)
stat("/home/az/.local/share/fish/fish_history", 0x7ffd4f2e4160) = -1 EACCES (Permission denied)
openat(AT_FDCWD, "/home/az/.bash_history", O_RDONLY|O_CLOEXEC) = 6
...So, first of all, that old .bash_history really is the old history I'm seeing.
Also, interesting that there is a EACCES (Permission denied) error.
For some reason, in /home/az/.local/share/:
drwx------ 3 root root 4096 Jan 16 2019 fish/I don't really know how I ended up having that.
Anyway, doing sudo chown az:users /home/az/.local/share/fish fixed the problem!