View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004067 | OpenFOAM | Bug | public | 2024-03-26 02:04 | 2024-07-02 14:32 |
Reporter | blackk100 | Assigned To | chris | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | GNU/Linux WSL2 | OS | Ubuntu | OS Version | 22.04 |
Product Version | 11 | ||||
Fixed in Version | dev | ||||
Summary | 0004067: Cleaned PATH eats up valid paths | ||||
Description | foamCleanPath considers whitespaces and colons as valid field separators, although Linux only specifies colons for splitting the actual paths (at least according to this https://www.linfo.org/path_env_var.html). This is especially an issue on WSL 2 as Windows appends its own PATH when installing the OS (in the form of /mnt/c/Program Files/...). This results in the user being unable to call Windows executables from the WSL OS (such as VS Code or explorer.exe). | ||||
Steps To Reproduce | Source etc/bashrc | ||||
Additional Information | This can be fixed easily if a copy of the PATH variable is made before souring etc/bashrc: win_path=$(sed "s|^$(sed "s|:/mnt.*$||g" <<< $PATH)||g" <<< $PATH) . /opt/openfoam11/etc/bashrc export PATH=$(sed "s|:/mnt.*$|$win_path|g" <<< $PATH) unset win_path | ||||
Tags | No tags attached. | ||||
|
This is an update to the workaround to deal with regex metacharacters in the PATH. This also assumes that the first mount point in the PATH is located after any OpenFOAM paths, and is run in bash. path_wsl=$(sed 's|:/mnt.*||' <<< $PATH) path_wsl=$(sed -e 's|\^|\\\^|g' -e 's|\$|\\\$|g' -e 's|\*|\\\*|g' -e 's|\+|\\\+|g' -e 's|\?|\\\?|g' -e 's|\.|\\\.|g' <<< $path_wsl) path_win=$(sed "s|^$path_wsl||" <<< $PATH) . /opt/openfoam11/etc/bashrc path_wsl=$(sed 's|:/mnt.*||' <<< $PATH) export PATH="$path_wsl$path_win" unset path_wsl path_win |
|
We have updated the foamCleanPath script in OpenFOAM-dev https://github.com/OpenFOAM/OpenFOAM-dev/commit/d7d83a923ae7686807d5d2d1e5b9271f164e2093 |
|
In our tests, the updated foamCleanPath script preserves spaces in directory names on the PATH The openfoam-dev package for Ubuntu 24.04 and 22.04 includes this change, so you could also test it. |
|
I just tested OpenFOAM-dev, and it's preserving spaces now. Thank you! |
|
Thanks for the feedback. Others have confirmed the same. I think this is fixed. |
|
Resolved |
Date Modified | Username | Field | Change |
---|---|---|---|
2024-03-26 02:04 | blackk100 | New Issue | |
2024-03-27 19:55 | blackk100 | Note Added: 0013219 | |
2024-07-01 17:05 | chris | Note Added: 0013291 | |
2024-07-01 17:11 | chris | Note Added: 0013292 | |
2024-07-01 23:07 | blackk100 | Note Added: 0013293 | |
2024-07-02 09:00 | chris | Note Added: 0013294 | |
2024-07-02 09:00 | chris | Assigned To | => chris |
2024-07-02 09:00 | chris | Status | new => closed |
2024-07-02 09:00 | chris | Resolution | open => fixed |
2024-07-02 09:00 | chris | Note Added: 0013295 | |
2024-07-02 14:32 | will | Status | closed => resolved |
2024-07-02 14:32 | will | Fixed in Version | => dev |