curusarn / resh

RESH ❯❯ Contextual shell history for zsh and bash
MIT License
1.01k stars 19 forks source link

Errors on empty home #142

Open Leseratte10 opened 4 years ago

Leseratte10 commented 4 years ago

I was trying to start a bash shell using an empty HOME folder (for tests unrelated to resh), and that results in a bunch of resh errors.

When I run export HOME=$(mktemp -d), that results in

bash: /tmp/tmp.QyTXwj6Qdu/.resh/postcollect_last_run_out.txt: File or directory not found.
head: '/tmp/tmp.QyTXwj6Qdu/.resh/postcollect_last_run_out.txt' can't be opened for reading: File or directory not found.
resh-postcollect ERROR: 

then when I start a new bash with this manipulated HOME, I get these errors for each command:

__bp_precmd_invoke_cmd: Command not found. 
__bp_interactive_mode: Command not found. 

Is it possible to get rid of these errors when HOME is empty?

curusarn commented 4 years ago

@Leseratte10: This (https://github.com/curusarn/resh/commit/5b07e5cda8263e0eb5bfadd8f541d77db318d729) should fix the first part of the problem. Can you update (reshctl update) and try if you still see the issue?

The second part is that resh depends on bash-preexec - ~/.bash-preexec.sh file is copied into your home during installation. When you copy the .resh directory into the new home you should copy the ~/.bash-preexec.sh file as well. I know that this is not ideal. To be honest I didn't really anticipate people changing their home. I will think about how I can make the whole installation more contained so that this can't happen in the future.

Leseratte10 commented 4 years ago

Can confirm that the first issue is fixed and the second issue is still present.