* bug#38243: Zsh does not load /etc/profile values by default @ 2019-11-17 7:14 Danny O'Brien 2019-11-17 13:21 ` Leo Prikler 2019-11-17 21:42 ` Ludovic Courtès 0 siblings, 2 replies; 5+ messages in thread From: Danny O'Brien @ 2019-11-17 7:14 UTC (permalink / raw) To: 38243 [-- Attachment #1: Type: text/plain, Size: 644 bytes --] Right now, an installation of zsh as a primary shell won't read in the environmental settings in /etc/profile -- it looks for (but doesn't find) a /etc/zprofile file instead. Not sure what the correct approach should be here. We could symlink /etc/zprofile to /etc/profile , but that would require knowing that /etc/profile was always available. Or we could include a source'ing of /etc/profile in /etc/zprofile. I'm not sure what status /etc/profile holds in Guix -- is it the canonical location for any user-wide environment settings? Will it be guaranteed to be POSIXly correct, rather than having any bashisms? Thanks for your work, d. [-- Attachment #2: Type: text/html, Size: 736 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#38243: Zsh does not load /etc/profile values by default 2019-11-17 7:14 bug#38243: Zsh does not load /etc/profile values by default Danny O'Brien @ 2019-11-17 13:21 ` Leo Prikler 2019-12-08 6:15 ` Danny O'Brien 2019-11-17 21:42 ` Ludovic Courtès 1 sibling, 1 reply; 5+ messages in thread From: Leo Prikler @ 2019-11-17 13:21 UTC (permalink / raw) To: danny; +Cc: 38243 > I'm not sure what status /etc/profile holds in Guix -- is it the > canonical location for any user-wide environment settings? Will it > be > guaranteed to be POSIXly correct, rather than having any bashisms? It is currently not and I'm not sure whether it will be. The current behaviour is known to cause problems with fish, though, so a proper solution would be appreciated. The real culprit seems likely to be $GUIX_PROFILE/etc/profile, which are sourced by /etc/profile. As far as zsh is concerned, it does seem to work despite the bashisms, as long as you can get it to source /etc/profile. > Not sure what the correct approach should be here. We could symlink > /etc/zprofile to /etc/profile , but that would require knowing that > /etc/profile was always available. Or we could include a source'ing > of > /etc/profile in /etc/zprofile. I'd rather generate a separate file. In zsh, you would also have to expand fpath to include Guix' autocompletion stuff, which works out of the box for bash. Given the aforementioned bashisms in $GUIX_PROFILE/etc/profile, we may also want to keep a $GUIX_PROFILE/etc/zprofile, although ideally we would make our profiles POSIXly correct instead. Regards, Leo ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#38243: Zsh does not load /etc/profile values by default 2019-11-17 13:21 ` Leo Prikler @ 2019-12-08 6:15 ` Danny O'Brien 2019-12-08 9:01 ` Leo Prikler 0 siblings, 1 reply; 5+ messages in thread From: Danny O'Brien @ 2019-12-08 6:15 UTC (permalink / raw) To: Leo Prikler; +Cc: 38243 [-- Attachment #1: Type: text/plain, Size: 2256 bytes --] On Sun, Nov 17, 2019 at 5:22 AM Leo Prikler <leo.prikler@student.tugraz.at> wrote: > > Not sure what the correct approach should be here. We could symlink > > /etc/zprofile to /etc/profile , but that would require knowing that > > /etc/profile was always available. Or we could include a source'ing > > of > > /etc/profile in /etc/zprofile. > I took a closer look at this, and currently Zsh users have /etc/profile included in their environment by virtue of a default $HOME/.zprofile, which is created in their home directory when they are created (via `useradd` and /etc/skel ). I'm a little stuck to know what to do here -- if we source /etc/profile in /etc/zprofile, then we risk sourcing it twice for users who have the current default ~/.zprofile already in their home directories`. OTOH, if users come to Guix System with their own pre-existing home directory, then they may well struggle --- as I did -- because important environment variables aren't set by their established ~/.zshrc, ~/.zprofile or ~/.zlogin setups. I *think* the right thing to do is to drop the current /etc/skel/.zprofile and establish that /etc/zprofile (and other shells) should source /etc/profile . Guix System does a lot of setup in /etc/profile including including $GUIX_PROFILE/etc/profile. It would be best if this automatically happened, whatever is going on in individual home directories. I'm a Guix newbie though, so I'm happy to take advice! Archlinux has a one-line /etc/zprofile which sources /etc/profile ; Debian does not; I have not checked other distributions, but I could. A couple of Guix commits where the current behavior was established: commit 2f4d43584cb26315c028dfbd2197da0d175933a2 Author: Chris Marusich <cmmarusich@gmail.com> Date: Sat Oct 13 22:50:36 2018 -0700 system: Rename .zlogin to .zprofile. Reported by Meiyo Peng <meiyo.peng@gmail.com>. * gnu/system/shadow.scm (default-skeletons): Rename zlogin to zprofile. commit 02f707c590fa3c5bbd74168468bf561b47317f71 Author: Sou Bunnbu (宋文武) <iyzsong@gmail.com> Date: Fri Dec 5 21:17:49 2014 +0800 system: Add skeleton '.zlogin'. * gnu/system/shadow.scm (default-skeletons): Add .zlogin. Best, d. [-- Attachment #2: Type: text/html, Size: 2985 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#38243: Zsh does not load /etc/profile values by default 2019-12-08 6:15 ` Danny O'Brien @ 2019-12-08 9:01 ` Leo Prikler 0 siblings, 0 replies; 5+ messages in thread From: Leo Prikler @ 2019-12-08 9:01 UTC (permalink / raw) To: Danny O'Brien; +Cc: 38243 Am Samstag, den 07.12.2019, 22:15 -0800 schrieb Danny O'Brien: > I took a closer look at this, and currently Zsh users have > /etc/profile included in their environment by virtue of a default > $HOME/.zprofile, which is created in their home directory when they > are created (via `useradd` and /etc/skel ). It appears, though, that some Guix users lack this skeleton, perhaps those who used it before the change. > I'm a little stuck to know what to do here -- if we source > /etc/profile in /etc/zprofile, then we risk sourcing it twice for > users who have the current default ~/.zprofile already in their home > directories`. OTOH, if users come to Guix System with their own pre- > existing home directory, then they may well struggle --- as I did -- > because important environment variables aren't set by their > established ~/.zshrc, ~/.zprofile or ~/.zlogin setups. I don't think the problem is as bad as you make it out to be. If we write channel news describing the move of .zprofile to /etc/zprofile, people ought to see it and be able to prevent the double-sourcing. > I *think* the right thing to do is to drop the current > /etc/skel/.zprofile and establish that /etc/zprofile (and other > shells) should source /etc/profile . Guix System does a lot of setup > in /etc/profile including including $GUIX_PROFILE/etc/profile. It > would be best if this automatically happened, whatever is going on in > individual home directories. I'm a Guix newbie though, so I'm happy > to take advice! Archlinux has a one-line /etc/zprofile which sources > /etc/profile ; Debian does not; I have not checked other > distributions, but I could. The real problem with $GUIX_PROFILE/etc/profile is its shell-specific behaviour. The weird syntax used there *happens* to be supported by zsh, but other shells (most notably fish, but e.g. also Eshell[1]) do not like it. To solve this problem not just for one shell, but for all of them, we should write a portable $GUIX_PROFILE/etc/profile. Same for /etc/profile. Then we can source it from other shells. Again, sourcing it from /etc/zprofile is fine even without that change, as zsh happens to eat this syntax without complaints, but other shells do not like it. Regards, Leo [1] Eshell is a weird one. Sourceing the file directly appears to work, but does nothing. Setting $GUIX_PROFILE instead causes the user to be prompted for an alias. ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#38243: Zsh does not load /etc/profile values by default 2019-11-17 7:14 bug#38243: Zsh does not load /etc/profile values by default Danny O'Brien 2019-11-17 13:21 ` Leo Prikler @ 2019-11-17 21:42 ` Ludovic Courtès 1 sibling, 0 replies; 5+ messages in thread From: Ludovic Courtès @ 2019-11-17 21:42 UTC (permalink / raw) To: Danny O'Brien; +Cc: 38243 Hi Danny, "Danny O'Brien" <danny@spesh.com> skribis: > Right now, an installation of zsh as a primary shell won't read in the > environmental settings in /etc/profile -- it looks for (but doesn't > find) a /etc/zprofile file instead. > > Not sure what the correct approach should be here. We could symlink > /etc/zprofile to /etc/profile , but that would require knowing that > /etc/profile was always available. Or we could include a source'ing of > /etc/profile in /etc/zprofile. > > I'm not sure what status /etc/profile holds in Guix -- is it the > canonical location for any user-wide environment settings? There’s also /etc/environment, honored by ‘pam_env’, and thus shell-independent. > Will it be guaranteed to be POSIXly correct, rather than having any > bashisms? It’s meant to be POSIX. If you notice Bash-specific constructs, we can surely remove those (I see a couple of “export VAR=value”, which is not POSIX, but maybe Zsh supports it?). Let us know what’s needed! Thanks, Ludo’. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-12-08 9:02 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-11-17 7:14 bug#38243: Zsh does not load /etc/profile values by default Danny O'Brien 2019-11-17 13:21 ` Leo Prikler 2019-12-08 6:15 ` Danny O'Brien 2019-12-08 9:01 ` Leo Prikler 2019-11-17 21:42 ` Ludovic Courtès
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/guix.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).