fedeliallalinea wrote:Run zsh -i -x -c exit &> /tmp/zsh-output-debug.txt command, then read /tmp/zsh-output-debug.txt file
Ok, so i've done this
- disable zsh prompt theme
- disable other things inside my .zshenv
- delete my .zshrc
the result of the above command is:
Code: Select all
+/home/myusername/.zshenv:13> export PATH=/home/myusername/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/12/bin
+zsh:1> exit
to my understanding, the zsh prompt is exporting the PATH variable as expected, however running echo $PATH does not show my .local/bin folder, so i guess something external is overriding the path.
I've also tried this
- create a new user called zshuser
- assign home folder and zsh prompt
- create a file .zshenv with only export path statement
- logout and login
- echo $PATH
- .local/bin/ is not in $PATH
Finally i think every time i log in with zsh the default files within /etc/ are the responsible of overriding my path, an inspection to /etc/zsh/zprofile show this
Code: Select all
# /etc/zsh/zprofile
# Load environment settings from profile.env, which is created by
# env-update from the files in /etc/env.d
if [[ -e /etc/profile.env ]] ; then
. /etc/profile.env
fi
# You should override these in your ~/.zprofile (or equivalent) for per-user
# settings. For system defaults, you can add a new file in /etc/profile.d/.
export EDITOR=${EDITOR:-/bin/nano}
export PAGER=${PAGER:-/usr/bin/less}
# 077 would be more secure, but 022 is generally quite realistic
umask 022
# Set up PATH depending on whether we're root or a normal user.
# There's no real reason to exclude sbin paths from the normal user,
# but it can make tab-completion easier when they aren't in the
# user's PATH to pollute the executable namespace.
#
# It is intentional in the following line to use || instead of -o.
# This way the evaluation can be short-circuited and calling whoami is
# avoided.
if [[ "$EUID" = "0" ]] || [[ "$USER" = "root" ]] ; then
# Check to make sure ROOTPATH is sane before we use it.
# https://bugs.gentoo.org/656400
if [[ :${ROOTPATH}: == *:/usr/sbin:* ]]; then
PATH="${ROOTPATH}"
fi
fi
export PATH
unset ROOTPATH
shopts=$-
setopt nullglob
for sh in /etc/profile.d/*.sh ; do
[[ -r "${sh}" ]] && . "${sh}"
done
unsetopt nullglob
set -$shopts
unset sh shopts
at the top of the file is sourcing /etc/profile.env
Code: Select all
# THIS FILE IS AUTOMATICALLY GENERATED BY env-update.
# DO NOT EDIT THIS FILE. CHANGES TO STARTUP PROFILES
# GO INTO /etc/profile NOT /etc/profile.env
export CONFIG_PROTECT='/usr/share/gnupg/qualified.txt'
export CONFIG_PROTECT_MASK='/etc/sandbox.d /etc/fonts/fonts.conf /etc/gentoo-release /etc/terminfo /etc/ca-certificates.conf'
export GCC_SPECS=''
export INFOPATH='/usr/share/gcc-data/x86_64-pc-linux-gnu/10.3.0/info:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.35.2/info:/usr/share/info'
export LANG='en_US.utf8'
export LESS='-R -M --shift 5'
export LESSOPEN='|lesspipe %s'
export MANPAGER='manpager'
export MANPATH='/usr/share/gcc-data/x86_64-pc-linux-gnu/10.3.0/man:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.35.2/man:/usr/local/share/man:/usr/share/man:/usr/lib/rust/man:/usr/lib/llvm/12/share/man'
export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/12/bin'
export ROOTPATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/12/bin'
so as you can see in the above code, /etc/profile.env is overriding the path variable acording to the arch wiki info
Code: Select all
/etc/zsh/zshenv
$ZDOTDIR/.zshenv <- Here is where i defined my .local/bin/ path
/etc/zsh/zprofile <- The default zprofile sources the /etc/profile.env causing the issue
/etc/profile
$ZDOTDIR/.zprofile
/etc/zsh/zshrc
$ZDOTDIR/.zshrc
/etc/zsh/zlogin
$ZDOTDIR/.zlogin
$ZDOTDIR/.zlogout
/etc/zsh/zlogout
Now i understand the problem, but then how can i export my path? since using .zshrc is not a good place to put your env variables.
Do you think it would be a good idea to delete/override the default /etc/zsh files? I would prefer not to do it, but i'm running out of ideas
The /etc/profile.env file is generated by env-update, which i used during the gentoo installation, so i'm very unsure of what to do now
