brainvisa / casa-distro

Unified development environment for BrainVISA projects.
2 stars 1 forks source link

Incorrect homedir symlinks created during read-write install with a shared install #361

Closed ylep closed 3 months ago

ylep commented 3 months ago

Describe the bug This is a corner-case bug, which is triggered in the unusual event that two conditions are fulfilled simultaneously:

In that case, a home is created in the environment, and the symlinks (.anatomist, etc.) are broken because they point to a non-existent /host/casa/home directory.

To Reproduce

$ mkdir test-bvinst
$ apptainer run -B test-bvinst:/casa/setup brainvisa-cea-5.1.1/brainvisa-cea-5.1.1.sif
The software is now setup in a new user environment.
Now you can add in the PATH environment variable of your host system the bin/ subdirectory of the install directory. You may add it in your $HOME/.bashrc config file:

export PATH="<install_dir>/bin:$PATH"

(replacing "<install_dir> with the install directory). Then, after opening a new terminal, or sourcing the $HOME/.bashrc file, you can run programs like "bv", "anatomist", "brainvisa" etc.
The "bv" program without arguments runs a configuration interface that allows to customize the installation settings, environment variables, mount points in the virtual image, etc.
[2024-06-06 14:46:25 +0200] /volatile/opt $ rm -r test-bvinst/home
rm : supprimer 1 argument récursivement ? y
$ ./test-bvinst/bin/bv
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-yl243478'
copying BrainVisa installation into a writable directory...
The software is now setup in a new user environment.
Now you can add in the PATH environment variable of your host system the bin/ subdirectory of the install directory. You may add it in your $HOME/.bashrc config file:

export PATH="<install_dir>/bin:$PATH"

(replacing "<install_dir> with the install directory). Then, after opening a new terminal, or sourcing the $HOME/.bashrc file, you can run programs like "bv", "anatomist", "brainvisa" etc.
The "bv" program without arguments runs a configuration interface that allows to customize the installation settings, environment variables, mount points in the virtual image, etc.
SAVE
$ ls -lA ./test-bvinst/home
total 8
lrwxrwxrwx 1 yl243478 domain users   26 juin   6 14:47 .anatomist -> /host/casa/home/.anatomist
-rw-r--r-- 1 yl243478 domain users 1332 juin   6 14:47 .bashrc
lrwxrwxrwx 1 yl243478 domain users   26 juin   6 14:47 .brainvisa -> /host/casa/home/.brainvisa
lrwxrwxrwx 1 yl243478 domain users   30 juin   6 14:47 .soma-workflow -> /host/casa/home/.soma-workflow
lrwxrwxrwx 1 yl243478 domain users   34 juin   6 14:47 .soma-workflow.cfg -> /host/casa/home/.soma-workflow.cfg
-rw-r--r-- 1 yl243478 domain users    0 juin   6 14:47 .sudo_as_admin_successful
drwxr-xr-x 3 yl243478 domain users 4096 juin   6 14:47 .varlib

Expected behavior No home directory should be created in the environment, so that it remains a shared install.

Environment:

denisri commented 3 months ago

I have pushed a fix, but have not made a new image to test it...

ylep commented 3 months ago

Aww, I have also implemented a fix, and am building an image right now to test. Sorry, I should have mentioned explicitly that I was working on it (I merely assigned the issue to myself but that was clearly not explicit enough).