Open nisbet-hubbard opened 1 month 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
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.
Hm OK I want to try to repro this ...
I can't reproduce this
HISTFILE=~/.bash_history osh
osh$ history # now it loads the history from that file
This needs a better repro
in both bash and OSH -- describe the steps, and then describe where OSH differs
After I exit OSH, and it writes the history file, it seems fine too
Here’s the relevant steps. I was doing
HISTFILE=~/.bash_history osh
osh$ history -a
whereas you were doing
HISTFILE=~/.bash_history osh
osh$ history
That’s why my .bash_history got clobbered when yours was fine. The key is the following bash behaviour
When the shell starts up, the history is initialized from the file named by the HISTFILE variable (default ~/.bash_history).
This isn’t currently implemented in osh, although one can do it manually like you’ve done above.
Currently, even after setting osh’s $HISTFILE to a different location (
~/.bash_history
in our case) throughoshrc
, invokinghistory
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 thehistory
list are populated with the same commands from the old~/.local/share/oils/osh_history
.