You are not logged in.
hi,
bash's PATH contains extra paths to site_perl, vendor_perl and core_perl.
$ ps h -p $PPID
12780 ? Ss 0:00 urxvt
$ echo "${PATH//:/$'\n'}" | sort | uniq -c
1 /usr/bin
1 /usr/bin/core_perl
1 /usr/bin/site_perl
1 /usr/bin/vendor_perl
1 /usr/local/bin
1 /usr/local/sbin
$ ps h -p $PPID
24573 ? 00:00:07 tmux: server
$ echo "${PATH//:/$'\n'}" | sort | uniq -c
1 /usr/bin
2 /usr/bin/core_perl
2 /usr/bin/site_perl
2 /usr/bin/vendor_perl
1 /usr/local/bin
1 /usr/local/sbin
first, I can't find where it comes from.
second, why are they "doubled" in tmux ?
and finally, are these perl's paths really worth ?
Last edited by N_BaH (2019-01-14 12:46:00)
Offline
first, I can't find where it comes from.
The shell environment is set by /etc/profile and the shell snippet files in /etc/profiles.d/; the shell sources those files during login.
In this particular case, it's /etc/profiles.d/perlbin.sh.
second, why are they "doubled" in tmux ?
If you look at /etc/profiles.d/perlbin.sh, you'll notice that it simply appends the paths to $PATH without checking if the paths are already part of $PATH (typically, those shell snippets don't expect to be sourced multiple times).
The problem is that tmux appears to launch a login shell, and even though $PATH is already fully populated at that point, the login shell sources /etc/profile again, and everything is added a second time.
(this does not happen for /usr/bin, /usr/local/bin and /usr/local/sbin, because /etc/profile actually checks for duplicates—but the others don't)
and finally, are these perl's paths really worth ?
They contain perl scripts. However, I don't quite know why they have to be dropped in a separate directory and not just in /usr/bin… I guess there is some (unknown-to-me) legacy reason.
Last edited by ayekat (2019-01-14 10:51:14)
Offline
In this particular case, it's /etc/profiles.d/perlbin.sh.
thank you.
I guess it should be sourced, but I can't find where.
grep -r 'perlbin' /etc/ /usr/
returns no results.
Last edited by N_BaH (2019-01-14 12:03:58)
Offline
Have a look at /etc/profile. In particular, these lines:
# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
for profile in /etc/profile.d/*.sh; do
test -r "$profile" && . "$profile"
done
unset profile
fi
This also explains why your grep there doesn't give any results.
Offline
of course!
thank you very much.
I've made some changes to the files so appendpath function can be applied into perlbin.sh
# diff /etc/profile{,.orig}
15c15,17
< export -f appendpath
---
>
> unset appendpath
>
29,30d30
<
< unset appendpath
# diff /etc/profile.d/perlbin.sh{,.orig}
6,7c6,7
< [ -d /usr/bin/site_perl ] && appendpath /usr/bin/site_perl #PATH=$PATH:/usr/bin/site_perl
< [ -d /usr/lib/perl5/site_perl/bin ] && appendpath /usr/lib/perl5/site_perl/bin #PATH=$PATH:/usr/lib/perl5/site_perl/bin
---
> [ -d /usr/bin/site_perl ] && PATH=$PATH:/usr/bin/site_perl
> [ -d /usr/lib/perl5/site_perl/bin ] && PATH=$PATH:/usr/lib/perl5/site_perl/bin
9,10c9,10
< [ -d /usr/bin/vendor_perl ] && appendpath /usr/bin/vendor_perl #PATH=$PATH:/usr/bin/vendor_perl
< [ -d /usr/lib/perl5/vendor_perl/bin ] && appendpath /usr/lib/perl5/vendor_perl/bin #PATH=$PATH:/usr/lib/perl5/vendor_perl/bin
---
> [ -d /usr/bin/vendor_perl ] && PATH=$PATH:/usr/bin/vendor_perl
> [ -d /usr/lib/perl5/vendor_perl/bin ] && PATH=$PATH:/usr/lib/perl5/vendor_perl/bin
12c12
< [ -d /usr/bin/core_perl ] && appendpath /usr/bin/core_perl #PATH=$PATH:/usr/bin/core_perl
---
> [ -d /usr/bin/core_perl ] && PATH=$PATH:/usr/bin/core_perl
Last edited by N_BaH (2019-01-14 13:02:33)
Offline