lb-docker-run bash -c does not get lhcb environment
I am not sure if this is a bug or a feature but here it goes.
Get latest lb-docker-run and update image
$ wget https://gitlab.cern.ch/lhcb-core/LbDocker/raw/master/scripts/lb-docker-run
...
$ python lb-docker-run --update true
v4: Pulling from lhcb-core/lbdocker/centos7-build
Digest: sha256:f67edf47de9984e1caea69c0df5f2e80da628863d47bc127ad5691ebebde6829
Status: Image is up to date for gitlab-registry.cern.ch/lhcb-core/lbdocker/centos7-build:v4
WARNING : using environment variable CMTCONFIG for cmtconfig
WARNING : using environment variable LHCBNIGHTLIES for nightlies_dir
********************************************************************************
* ---- LHCb Login v9r2p6 ---- *
* Building with gcc8 on centos7 x86_64 system (x86_64-centos7-gcc8-opt) *
********************************************************************************
--- LHCBPROJECTPATH 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
--------------------------------------------------------------------------------
Commands like which
run in the lhcb environment
$ python lb-docker-run which lb-run
WARNING : using environment variable CMTCONFIG for cmtconfig
WARNING : using environment variable LHCBNIGHTLIES for nightlies_dir
********************************************************************************
* ---- LHCb Login v9r2p6 ---- *
* Building with gcc8 on centos7 x86_64 system (x86_64-centos7-gcc8-opt) *
********************************************************************************
--- LHCBPROJECTPATH 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/lhcb/LBSCRIPTS/LBSCRIPTS_v9r2p6/InstallArea/scripts/lb-run
There is an exception for bash, for which lhcb.sh
is not sourced
$ python lb-docker-run bash -c 'which lb-run'
which: no lb-run in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)
Telling bash to act as if it had been invoked as a login shell seems to source lhcb.sh
$ python lb-docker-run bash -lc 'which lb-run'
WARNING : using environment variable CMTCONFIG for cmtconfig
WARNING : using environment variable LHCBNIGHTLIES for nightlies_dir
/cvmfs/lhcb.cern.ch/lib/lhcb/LBSCRIPTS/LBSCRIPTS_v9r2p6/InstallArea/scripts/lb-run
When running bash
(or just lb-docker-run
with no args) the lhcb env is sourced
$ python lb-docker-run [bash]
WARNING : using environment variable CMTCONFIG for cmtconfig
WARNING : using environment variable LHCBNIGHTLIES for nightlies_dir
********************************************************************************
* ---- LHCb Login v9r2p6 ---- *
* Building with gcc8 on centos7 x86_64 system (x86_64-centos7-gcc8-opt) *
********************************************************************************
--- LHCBPROJECTPATH 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
--------------------------------------------------------------------------------
[rmatev@154ee2ca756a workspace]$ which lb-run
/cvmfs/lhcb.cern.ch/lib/lhcb/LBSCRIPTS/LBSCRIPTS_v9r2p6/InstallArea/scripts/lb-run
[rmatev@154ee2ca756a workspace]$
Edited by Rosen Matev