blueCFD / Core

Coordination repository for the blueCFD-Core: Issue tracking, Wiki, project webpage and miscellaneous scripts
http://bluecfd.github.io/Core
53 stars 10 forks source link

The default installation path does not work in blueCFD-Core 2024-1 #257

Closed wyldckat closed 3 months ago

wyldckat commented 3 months ago

Note: We have added the following note next to the download links for blueCFD-Core 2024-1:

  • WARNING: We strongly suggest that you install in a path without spaces in the names for the folders, for example:
    • C:\blueCFD-Core\2024-1\
    • For more details, see Issue #257.

When we install at the default C:\Program Files\blueCFD-Core 2024-1, it is not able to source the etc/bashrc file for OpenFOAM, because MSYS2 has changed how pwd -P works since 2021. It used to give relative to the original mount path, but now it fully unravels the path to Windows' long path mode.

So either:

  1. We implement some method that supports long paths into etc/bashrc.
  2. Or we install by default at a new suggested path, e.g. C:\blueCFD-Core\2024-1, which can be fairly annoying, but given how we use the files within it, it might not be a bad idea overall.
wyldckat commented 3 months ago

So the simplest trick seems to be to define a bash function for pwd before sourcing OpenFOAM's bashrc, e.g.:

function pwd()
{
    bash -c pwd
}

Because this will give us the Linux-mode path, instead of the Windows-mode:

$ pwd
/home/ofuser/blueCFD/OpenFOAM-12

$ pwd -P
/c/Program Files/blueCFD-Core-2024/OpenFOAM-12

It is being used in the following situations:

$ grep -r pwd
bashrc:    export FOAM_INST_DIR=$(cd $(dirname $bashrcFile)/../.. && pwd -P)
bashrc:    WM_PROJECT_DIR_REAL=$(cd $WM_PROJECT_DIR && pwd -P)
bashrc:    WM_THIRD_PARTY_DIR_REAL=$(cd $WM_THIRD_PARTY_DIR && pwd -P)
config.csh/paraview:        set paraviewBinDir=`cd $pvserverBinDir && pwd -P`
config.sh/paraview:        paraviewBinDir=$(cd $paraviewBinDir && pwd -P)
pre-bashrc-custom-gcc47.sh:    export REF_OF_ETC=$(cd $(dirname $bashrcFile) && pwd -P)
pre-bashrc-custom-gcc48.sh:    export REF_OF_ETC=$(cd $(dirname $bashrcFile) && pwd -P)
pre-bashrc-mingw_w32.sh:    export REF_OF_ETC=$(cd $(dirname $bashrcFile) && pwd -P)
pre-bashrc-mingw_w64.sh:    export REF_OF_ETC=$(cd $(dirname $bashrcFile) && pwd -P)

Note: Cannot use cygpath -s -m for converting the path to Windows short path, because it gets stuck somehow.

wyldckat commented 3 months ago

The bash function has to rely on short paths, because the OpenFOAM scripts are not all ready for paths with spaces. Which means that we will either need:

  1. OpenFOAM 12 to support spaces in all of its scripts.
  2. Or have the installer propose an alternative path in function of the availability of short paths at the default paths.
wyldckat commented 3 months ago

Progress in solving the issues

  1. A good chunk of issues has been solved up to commit 74682c5adee9da71488630fe6437e0156c45e74d at https://github.com/blueCFD/OpenFOAM-dev/commits/blueCFD-Core-12/
  2. Test if the changes will allow running all tutorials with these changes.
  3. Adapt the installer to check if the disk volumes are supporting short paths.
    • Done, will be delivered in blueCFD-Core 2024-2.
wyldckat commented 3 months ago

All issues reported here have been fixed and will be delivered in blueCFD-Core 2024-2.