Skip to content

Detect exported functions with %%

Chris Burr requested to merge fix-bash-func-detect into master

Since bash 4.4 functions have been exported with %% as the suffix instead of ():

https://github.com/bminor/bash/commit/3590145af6f1c9fa321dff231f69ae696e7e740b#diff-f6e7b8cbb34a38aef6fa9559192cbc0b873c68475cabfb90192bb43239efa00fR88

On aivoadm this causes an error message on login:

********************************************************************************
*                               ---- LbEnv ----                                *
********************************************************************************
 --- User_release_area is set to /afs/cern.ch/user/c/cburr/cmtuser
 --- CMAKE_PREFIX_PATH is set to:
    /cvmfs/lhcb.cern.ch/lib/lhcb
    /cvmfs/lhcb.cern.ch/lib/lcg/releases
    /cvmfs/lhcb.cern.ch/lib/lcg/app/releases
    /cvmfs/lhcb.cern.ch/lib/lcg/external
    /cvmfs/lhcb.cern.ch/lib/contrib
    /cvmfs/lhcb.cern.ch/lib/var/lib/LbEnv/2199/stable/linux-64/lib/python3.8/site-packages/LbDevTools/data/cmake
--------------------------------------------------------------------------------
-bash: export: `BASH_FUNC_which%%=() { ( alias; eval declare -f ) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot "\$@" }': not a valid identifier

cc @chaen who originally noticed this

Merge request reports