View previous topic :: View next topic |
Author |
Message |
pillmuncher n00b
Joined: 08 Jan 2025 Posts: 2
|
Posted: Wed Jan 08, 2025 6:42 am Post subject: Order of zsh config files |
|
|
The official zsh docs say that /etc/zshenv is the first file that's sourced[*] when zsh is started, and in all cases, login/non-login and interactive/non-interactive. But I can't seem to get it to work like that. /etc/zshenv seems to be called, well, never, and /etc/zsh/zprofile only for login shells (which is correct).
I'm used to setting XDG_*_HOME and $ZDOTDIR (to move ~/.zshrc etc. to ~/.config/zsh/) in /etc/zshenv. What am I doing wrong? Or does Gentoo set up zsh differently? How? I cannot find anything in the Wiki.
[*] "Commands are first read from /etc/zshenv; this cannot be overridden" -- https://zsh.sourceforge.io/Doc/Release/Files.html#Startup_002fShutdown-Files |
|
Back to top |
|
|
bstaletic Guru
Joined: 05 Apr 2014 Posts: 452
|
Posted: Wed Jan 08, 2025 6:54 am Post subject: |
|
|
I have not tried, but I think zshenv should be in /etc/zsh/.
I say this, because the default zprofile is in that directory and gentoo ebuild configures zsh with --enable-etcdir="${EPREFIX}"/etc/zsh.
So it looks like wherever docs say /etc, we should be reading that as /etc/zsh. |
|
Back to top |
|
|
pillmuncher n00b
Joined: 08 Jan 2025 Posts: 2
|
Posted: Wed Jan 08, 2025 8:07 am Post subject: |
|
|
Yes, thank you, that was it. Now it works. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22955
|
Posted: Wed Jan 08, 2025 2:55 pm Post subject: |
|
|
This thread is useful as a record for anyone else who has the question, but I want to point out that strace could have been used to see what files zsh reads, and in what order. This would not explain why it works the way bstaletic describes, but it would address the immediate question of how to make it work.
The upstream documentation mentioned by OP makes passing mention that /etc may not be right:However, it does not inform the user how to determine what that other directory may be. In that regard, bstaletic's explanation seems reasonable to me. |
|
Back to top |
|
|
flexibeast Guru
Joined: 04 Apr 2022 Posts: 477 Location: Naarm/Melbourne, Australia
|
Posted: Thu Jan 09, 2025 12:27 am Post subject: |
|
|
The ebuild for Zsh has a src_configure which contains the line:
Code: | --enable-etcdir="${EPREFIX}"/etc/zsh |
without an accompanying patch to the zsh(1) man page to reflect this.
As both a Zsh user and a documentation writer, this presses my buttons, so i've just created an issue on b.g.o about this, offering to provide a patch:
https://bugs.gentoo.org/947747 _________________ https://wiki.gentoo.org/wiki/User:Flexibeast |
|
Back to top |
|
|
|