View Issue Details

IDProjectCategoryView StatusLast Update
0004037OpenFOAMBugpublic2023-11-28 17:00
ReporterLourencosm Assigned Tohenry  
Status closedResolutionsuspended 
PlatformUbuntu in WSLOSUbuntuOS VersionUbuntu 22.04
Product Version11 
Summary0004037: foamCleanPath replaces the space characters in the PATH system variable with ':'
DescriptionUsing OF11 in WSL, the PATH system variable contains Ms Windows paths with spaces.
When sourcing OF11, with 'source /opt/openfoam11/etc/bashrc', the 'foamCleanPath' in '/opt/openfoam11/bin/' replaces the space characters in the PATH system variable with ':'. Thus, breaking the existing paths.
TagsNo tags attached.



2023-11-22 12:20

manager   ~0013158

Paths with spaces are not supported in OpenFOAM.


2023-11-22 13:21

reporter   ~0013159

I know that. I'll try to explain again. The problem is that OF11 is breaking the paths that exist in the Linux PATH system variable.
With the growth of OF users using the Windows Subsystem for Linux (WSL), this issue could be addressed, as it was done in other OF distributions.


2023-11-22 13:48

manager   ~0013160

Which path in particular has spaces in it?

Despite the growth of OF users using the Windows Subsystem for Linux (WSL) none provide any OpenFOAM maintenance funding.


2023-11-22 15:43

reporter   ~0013161

Dear Henry,
I've much respect for you and I also understand the funding issue.
I just wanted to report a bug that affects WSL users, and contribute to a better
WSL installation is also proposed in

Feel free to close this report if it's not for the best interest of
Best regards

In my case, the PATH variable, before sourcing the OF11, has the following paths with spaces, automatically created by the the WSL:
/mnt/c/Program Files/Microsoft MPI/Bin/
/mnt/c/Program Files/ImageMagick-7.1.1-Q16-HDRI
/mnt/c/Program Files/Microsoft VS Code/bin
/mnt/c/Program Files/WinGet/Links
/mnt/c/Program Files/PuTTY/
/mnt/c/Program Files/Meld/
/mnt/c/Program Files/MiKTeX/miktex/bin/x64/
/mnt/c/Program Files/dotnet/
/mnt/c/Program Files/MATLAB/R2013b/bin


2023-11-22 16:53

updater   ~0013162

Something along the lines of the following information, can be added to the documentation page that instructs how to install OpenFOAM on WSL:

   Within the Ubuntu WSL terminal/console, edit the file `/etc/wsl.conf` and change/add the following entry, to disable the Windows PATH variable being merged into the Ubuntu environment:


   For more details, see



2023-11-22 23:47

reporter   ~0013163

I believe OpenFOAM is not the only source of problems when having pure spaces in your PATH variable. Try to avoid them on linux side or come up with a workaround. I'd recommend you to escape the whitespace by "\" which may already mitigate the problem. If not, then you could try to create a well behaving symlink into those directories.


2023-11-23 09:11

reporter   ~0013164

Wouldn't be simpler to modify 'foamCleanPath' to cope with spaces as it is done in OFv2306?
Can anyone explain to me why this is not an option? Or the best solution?
WSL is here to stay and will help a lot to spread OF.


2023-11-23 09:57

reporter   ~0013165

I think this is not really WSL related issue as such but more on the fact that if you use spaces in your PATH, they are changed, despite the platform. Having non-escaped characters can create anyway problems, that is the reason why typically you try to avoid them.

If you could point out the issue and provide a new logic with some testing, I believe the maintainers and rest of the community can indeed tackle the issue. Even if it is the "best" solution, somebody needs to do it and test it. If you can provide a solution, I'm happy to test it.


2023-11-28 17:00

manager   ~0013167

Pending funding from WSL users.

Issue History

Date Modified Username Field Change
2023-11-22 12:06 Lourencosm New Issue
2023-11-22 12:20 henry Note Added: 0013158
2023-11-22 13:21 Lourencosm Note Added: 0013159
2023-11-22 13:48 henry Note Added: 0013160
2023-11-22 15:43 Lourencosm Note Added: 0013161
2023-11-22 16:53 wyldckat Note Added: 0013162
2023-11-22 23:47 peksa Note Added: 0013163
2023-11-23 09:11 Lourencosm Note Added: 0013164
2023-11-23 09:57 peksa Note Added: 0013165
2023-11-28 17:00 henry Assigned To => henry
2023-11-28 17:00 henry Status new => closed
2023-11-28 17:00 henry Resolution open => suspended
2023-11-28 17:00 henry Note Added: 0013167