CONFIG: force loading of shell functions (issue #944)

- this avoids a situation when an aborted sourcing of the etc/bashrc
  file can leave WM_SHELL_FUNCTIONS defined, which causes all
  subsequent sourcing to fail.
This commit is contained in:
Mark Olesen
2018-07-19 16:57:38 +02:00
parent 34a7ea5da7
commit 957d8dc38d
2 changed files with 8 additions and 0 deletions

View File

@ -135,6 +135,7 @@ fi
export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
# Load shell functions # Load shell functions
unset WM_SHELL_FUNCTIONS
. $WM_PROJECT_DIR/etc/config.sh/functions . $WM_PROJECT_DIR/etc/config.sh/functions
# Overrides via <prefs.sh> # Overrides via <prefs.sh>

View File

@ -31,6 +31,7 @@ then
foamClean=$WM_PROJECT_DIR/bin/foamCleanPath foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
# Cleaning environment variables # Cleaning environment variables
unset -f _foamClean 2>/dev/null
_foamClean() _foamClean()
{ {
foamVar_name=$1 foamVar_name=$1
@ -41,6 +42,7 @@ then
# Source an etc file, possibly with some verbosity # Source an etc file, possibly with some verbosity
# - use eval to avoid intermediate variables (ksh doesn't have 'local') # - use eval to avoid intermediate variables (ksh doesn't have 'local')
unset -f _foamEtc 2>/dev/null
if [ "$FOAM_VERBOSE" -a "$PS1" ] if [ "$FOAM_VERBOSE" -a "$PS1" ]
then then
_foamEtc() _foamEtc()
@ -55,18 +57,21 @@ then
fi fi
# Prepend PATH # Prepend PATH
unset -f _foamAddPath 2>/dev/null
_foamAddPath() _foamAddPath()
{ {
[ -n "$1" ] && export PATH=$1:$PATH [ -n "$1" ] && export PATH=$1:$PATH
} }
# Prepend MANPATH # Prepend MANPATH
unset -f _foamAddMan 2>/dev/null
_foamAddMan() _foamAddMan()
{ {
[ -n "$1" ] && export MANPATH=$1:$MANPATH [ -n "$1" ] && export MANPATH=$1:$MANPATH
} }
# Prepend LD_LIBRARY_PATH # Prepend LD_LIBRARY_PATH
unset -f _foamAddLib 2>/dev/null
_foamAddLib() _foamAddLib()
{ {
[ -n "$1" ] && export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH [ -n "$1" ] && export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH
@ -83,6 +88,7 @@ then
# 2) Use fallback if the previous failed # 2) Use fallback if the previous failed
# #
# Return 0 on success # Return 0 on success
unset -f _foamAddLibAuto 2>/dev/null
_foamAddLibAuto() _foamAddLibAuto()
{ {
# Note ksh does not have 'local' thus these ugly variable names # Note ksh does not have 'local' thus these ugly variable names
@ -150,6 +156,7 @@ then
# Evaluate command-line parameters # Evaluate command-line parameters
unset -f _foamEval 2>/dev/null
_foamEval() _foamEval()
{ {
while [ $# -gt 0 ] while [ $# -gt 0 ]