I am trying to find which file adds /opt/texbin
folder to my PATH variable on Ubuntu. It is not present in my /etc/environment
file. sudo grep -lr texbin . 2>/dev/null
outputs nothing in the /etc
folder. And still if I add set -x
to the beginning of my /etc/zshenv
file I can see that /opt/texbin
is in my PATH before zsh sources this file.
Any ideas?
Answer
I would try this approach to track down the source of /opt/texbin
in your PATH variable:
To get a list of files, which are actually read in (e.g. a non-standard file might be sourced by another file!), you can invoke
zsh
with theSOURCE_TRACE
option enabled:$ zsh -o sourcetrace
+/etc/zshenv:1>
+/home/user/.zshrc:1>
+/home/user/.zcompdump:1>
+/home/user/.zshrc-last:1>Check these files, where the PATH variable come into play:
$ grep -ie "path.*=" files_from_step_1
The case insensitivity is crucial, since
zsh
uses the array$path
, which automatically gets converted to the bash-like colon-separated list$PATH
and vice versa.If still not lucky, try to include a debug message in
/etc/zshenv
, where commands are first read from:print -l $path
This will give you a nice list of the PATH variable, which zsh inherits from its parent process (display manager, init process, etc.).*
If the path is indeed inherited from the starting process, it is crucial to know which processes are relevant:
$ pstree -apH $$
This produces a process tree, where the shell process (pid in
$$
) is highlighted. Check the config files for these processes, too, and keep in mind thatsource /some/file
or. /some file
can also alter the PATH- if you edit e.g.
/etc/profile
in your current console, log off and log in again, the parent process (X logon manager) might still have the old environment.+
* As you have written, the PATH already contains /opt/texbin
before /etc/zshenv
is read, checked by set -x
in /etc/zshenv
. I get no output with this technique, but with my step 3, hence I included the other steps in my answer as well.
+Suffered myself badly due to this behavior some time ago...
No comments:
Post a Comment