Skip to content
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

etc/zprofile is being called twice causing CHERE_INVOKING to fail. #205

Closed
piyooshm opened this issue Oct 31, 2014 · 6 comments
Closed

etc/zprofile is being called twice causing CHERE_INVOKING to fail. #205

piyooshm opened this issue Oct 31, 2014 · 6 comments

Comments

@piyooshm
Copy link

Hi! I set CHERE_INVOKING=1 in babun.bat similar to what we do for standard cygwin installation for starting the shell in current dir. It didn't work. I tried installing chere package too, but was unsuccessful to start Babun in current dir. On further hacking/debugging, I found that the issue may be due to /etc/zprofile being called twice (I observed that it was called twice when I added an echo statement to the file). It deletes the variable after running the first time, so on the second time, the variable won't be available and it does a cd to ${HOME}. I believe that if you can prevent /etc/zprofile from running twice on startup, it will resolve the issue.

@piyooshm
Copy link
Author

An update: I started mintty without the trailing dash. That was able to resolve the issue, confirming my suspicion mentioned above. For some reason, the startup in login mode is causing the /etc/zprofile to execute twice.

@piyooshm
Copy link
Author

/etc/zshrc executes after /etc/zprofile. You are sourcing 3 files from /etc/zshrc. Amongst them, babun.zsh is sourcing /etc/zprofile again. So, your execution flow is: /etc/zprofile -> /etc/zshrc -> /usr/local/etc/babun.zsh -> /etc/zprofile. I hope you can fix the same now.

@tombujok
Copy link
Contributor

tombujok commented Feb 4, 2015

Thanks for the thorough analysis!
Would you like to submit a pull request with a fix? I would merge it and include in the next release.

@tombujok
Copy link
Contributor

Fixed in 1.1.0.
Release status: #266

@kubamarchwicki
Copy link
Contributor

This still seems to be an issue. With babun 1.1.1 I got a following startup log

in /etc/zprofile
in /etc/zshrc
in /etc/zprofile
{ ~ }  »                                                                                        ~

So the execution is still /etc/zprofile -> /etc/zshrc -> /usr/local/etc/babun.zsh -> /etc/zprofile and the second /etc/zprofile unables chere / xhere to sucessfully pass the path.

Unfortunately - besides tracing that I have no idea how to approach the change (and the implications).

I was using

{ ~ }  » babun --version                                                                        ~
babun version 1.1.1
Created and maintained by Tom Bujok (@tombujok)
Copyright (c) 2014-2015.

@kubamarchwicki
Copy link
Contributor

One more thing. This happens when I run babun from the shortcut C:\Windows\system32\cmd.exe /c "C:\Users\jmarchwicki\.babun\babun.bat"

However, if I click already open icon and run Terminal - I got the following errors (with source /etc/zprofile in /usr/local/etc/babun.zsh commented out).
With the original /usr/local/etc/babun.zsh I don't experience such problem (and also shell here doesn't work).

/usr/local/etc/babun/source/babun-core/tools/plugins.sh: line 105: bash: command not found
Could not start plugin [git]
/usr/local/etc/babun/source/babun-core/tools/plugins.sh: line 105: bash: command not found
Could not start plugin [core]
/usr/local/etc/babun/source/babun-core/tools/plugins.sh: line 105: bash: command not found
Could not start plugin [cygdrive]
/cygdrive/c/Users/jmarchwicki/.oh-my-zsh/oh-my-zsh.sh:3: command not found: env
/cygdrive/c/Users/jmarchwicki/.oh-my-zsh/lib/theme-and-appearance.zsh:9: command not found: uname
/cygdrive/c/Users/jmarchwicki/.oh-my-zsh/lib/theme-and-appearance.zsh:13: command not found: uname
compaudit:132: command not found: getent
{ system32 }  »                                                      /cygdrive/c/Windows/system32

Having traced that (obviously by accident) I'm rather lost with what's going on but I hope smb will find it helpful (feels like tester ;>)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants