oils-for-unix / oils

Oils is our upgrade path from bash to a better language and runtime. It's also for Python and JavaScript users who avoid shell!
http://www.oilshell.org/
Other
2.84k stars 156 forks source link

`~/.local/share/oils/osh_history` interferes with $HISTFILE #2083

Open nisbet-hubbard opened 3 weeks ago

nisbet-hubbard commented 3 weeks ago

Currently, even after setting osh’s $HISTFILE to a different location (~/.bash_history in our case) through oshrc, invoking history upon entering an osh lists only the commands stored in the old ~/.local/share/oils/osh_history.

At this moment, at least ~/.bash_history remains intact.

If you then invoke history -a, however, osh replaces the commands in ~/.bash_history (ie $HISTFILE) with those in ~/.local/share/oils/osh_history, with the result that now both $HISTFILE and the history list are populated with the same commands from the old ~/.local/share/oils/osh_history.

andychu commented 3 weeks ago

Hm so you are setting HISTFILE=foo in oshrc, and it's being ignored?

What about HISTFILE=foo osh , so it's in the environment?

This might be an ordering issue ...


also bash does some weird stuff like calling libc functions when you do LANG=C, I'm not sure if it does something similar when doing HISTFILE=foo, like readline.set_history_file('foo') or something

nisbet-hubbard commented 3 weeks ago

Yes, I can confirm HISTFILE=foo is in the environment. The problem isn’t foo’s being ignored, but that it’s being tampered with using ~/.local/share/oils/osh_history.

So, osh overwrites foo with whatever is in ~/.local/share/oils/osh_history whenever I exit osh.