Skip to content

Compare real paths when checking for the current directory in singularity

Chris Burr requested to merge fix-nersc-2 into master

There is some fishy behaviour at one grid site, which I suspect it caused by multiple mounts + symlinks being involved in mounting the home directory:

$ pwd
/global/homes/r/roma
$ realpath $(pwd)
/global/u1/r/roma
$ python -c 'import os; print(os.getcwd())'
/global/u1/r/roma
$ singularity exec --bind /cvmfs/ --userns /cvmfs/cernvm-prod.cern.ch/cvm4 python -c 'import os; print(os.getcwd())'
/global/homes/r/roma
$ python -c 'import os; print(os.getenv("PWD"))'
/global/homes/r/roma
$ ls -ltrah /global/homes
lrwxrwxrwx 1 root root 10 Aug  9 21:00 /global/homes -> /global/u1

I haven't managed to reproduce the issue elsewhere but I think this fix should be safe and makes sense.

Merge request reports