perl-local-lib/perl-homedir.csh
John Hein 54637e7ee1 Ensure csh syntax is used for C shell even if SHELL env var is unset.
We know we're running from C shell in perl-homedir.csh, so be
explicit rather than letting local::lib guess.

If the SHELL environment variable is not set, perl -Mlocal::lib is
fooled into emitting bourne shell syntax (e.g., export FOO=bar)
instead of csh syntax (setenv FOO bar).  This can be fatal to the
C shell possibly interrupting execution of a script before the
script has completed.

This (no SHELL variable set) can happen, for instance, when running a
cron job.

See also:
https://bugzilla.redhat.com/show_bug.cgi?id=2122359
https://issues.redhat.com/browse/RHEL-5545

Signed-off-by: John Hein <c0eh3p702@sneakemail.com>
2023-11-21 22:38:59 -07:00

21 lines
599 B
Tcsh

# invoke local::lib
# default -- invoke local::lib for all users
setenv PERL_HOMEDIR 1
# load our configs, aka opportunities to set PERL_HOMEDIR=0
if (-f /etc/sysconfig/perl-homedir) then
eval `sed -ne 's|^[[:blank:]]*\([^#=]\{1,\}\)=\([^=]*\)|setenv \1 \2;|p' /etc/sysconfig/perl-homedir`
endif
if (-f "$HOME/.perl-homedir") then
eval `sed -ne 's|^[[:blank:]]*\([^#=]\{1,\}\)=\([^=]*\)|setenv \1 \2;|p' "$HOME/.perl-homedir"`
endif
alias perlll 'eval "`env SHELL=csh perl -Mlocal::lib`"'
# if system default
if ("x$PERL_HOMEDIR" == "x1") then
eval "`env SHELL=csh perl -Mlocal::lib`"
endif