source bashrc in WSL causes bash: eval: line 38: syntax error near unexpected token `('
I tried to load the bashrc in WSL but I get the error:
bash: eval: line 38: syntax error near unexpected token `('
similar problem here.
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Link issues together to show that they're related. Learn more.
Activity
- Author Maintainer
this user believes it is an OpenFOAM build issue. I don't think so though.
By Foad on 2018-09-14T21:55:03 (imported from GitLab project)
- Author Maintainer
Launch the Ubuntu bash on WSL and run:
echo $PATH
If I remember correctly, you will probably get something in the path referring to
C:\Program Files (x86)\
and that is likely what's breaking it.The workaround is reaaaally simple, before sourcing OpenFOAM's environment, run:
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
It's essentially just the basic settings for a bash shell in a Linux Distribution.
WSL sources the Windows PATH environment shell... simply because reasons.
By Bruno Santos on 2018-09-14T22:30:24 (imported from GitLab project)
- Author Maintainer
@wyldckat My solution is not as easy as yours, but in general I agree with you that it is a WSL issue. However here in the WSL GitHub repo they believe it is an OpenFOAM issue. you may wanna look into that too.
By Foad on 2018-09-14T22:35:20 (imported from GitLab project)
- Author Maintainer
I let my bitterness towards Microsoft come up to the surface in my previous post... I've been bitten by issues on Windows so many times, that I tend to have allergic responses to these kinds of situations...
So here's the situation: Inheriting the
PATH
environment variable into the Ubuntubash
on WSL is a feature. The reason is that it is possible to run Windows applications within the Ubuntubash
on WSL, if I remember correctly. This may be useful to have a way for Linux binaries to interact with Windows binaries, to do cross-operating-system applications and developments (e.g. as we can do with WINE on Linux).The problem is that this is done by default, which is essentially a security hazard of sorts. Of course that having a computer connected to the Internet is a security hazard by definition, it's just that we try to use as much software and proper configurations to avoid getting a bad time.
Therefore, as with any Operating System, it's left to the user to secure things on their own (e.g. ages ago, users had to purchase anti-virus software) or in this case, if you know that you will be running Linux applications that cannot handle finding alien binaries from Windows' in the
PATH
environment variable, then it's up to the user to change saidPATH
variable.From my own experience with porting OpenFOAM to Windows, we have used MSys and MSys2 successfully for years now, but one of the first things our launching scripts do is eliminate alien paths from the
PATH
environment variable, because incompatiblezlib
libraries tended to be picked up by accident, or the wrongfind
application was being used.All of this to say that:
-
Yes, this is a limitation on OpenFOAM's part, because using unconventional characters in paths is... unconventional. Supporting all possible configurations can be considerably distressful, specially if Unicode comes in to play...
-
If anything needs to be done on WSL's side, it would be to have an option regarding whether
PATH
should be inherited by default from Windows. And that's very ambiguous, given that the users can simply add the command line I mentioned in my previous post and problem solved... no more feet will get shot from that day onward...
@foadsf: I don't have a WSL installation at hand right now, please check if the following command:
grep "PATH=" /etc/login.defs
gives the following output:
ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
I ask this because this may be the more standardized way to have instructions that can be used with WSL, either with Ubuntu or any other Linux Distribution running within WSL. What I mean is that we could have a single command that uses this default path, without having to hard-code it, e.g. by running:
grep "ENV_PATH" /etc/login.defs | sed -e 's=ENV_PATH==' | xargs export
although it does look more convoluted...
By Bruno Santos on 2018-09-14T23:18:51 (imported from GitLab project)
-
- Admin mentioned in issue #1008 (closed)
mentioned in issue #1008 (closed)
By Foad on 2018-09-16T22:03:10 (imported from GitLab project)
- Mark OLESEN mentioned in commit b7054272989a0e5fddbaf6dfbdbfb726f7db8539
mentioned in commit b7054272989a0e5fddbaf6dfbdbfb726f7db8539
- Mark OLESEN mentioned in commit 0a2768667f4aa0eb02e41ab2a2de72dbf00e4af6
mentioned in commit 0a2768667f4aa0eb02e41ab2a2de72dbf00e4af6
- Mark OLESEN assigned to @mark
assigned to @mark
- Maintainer
The shell sourcing issue mainly seems to be from the
foamCleanPath
script, which I've now changed (commit 0a276866). If you don't wish to update your installation much, you can just try replacing that one file and see if it solves some/all of the issues.I tested local (on Linux) with the following:
PATH="/tmp/path\ with\(tm\):$PATH:/other\ Documents" source ~/OpenFOAM/OpenFOAM-plus/etc/bashrc
Runs through without complaint. Checking the resulting environment
echo "$PATH" | tr ':' '\n'
everything seems to be OK.
- Mark OLESEN mentioned in issue #1030 (closed)
mentioned in issue #1030 (closed)
- Mark OLESEN mentioned in commit 2e102ce6b1cc7f3e9dd5868af9632983a6b205e7
mentioned in commit 2e102ce6b1cc7f3e9dd5868af9632983a6b205e7
- Mark OLESEN mentioned in commit 1cb7e7b5d0a7d6ed1c3f0a76d72ff00ca48715cf
mentioned in commit 1cb7e7b5d0a7d6ed1c3f0a76d72ff00ca48715cf
- Mark OLESEN mentioned in commit 1a5196222684755c8a543dd1538def93567513de
mentioned in commit 1a5196222684755c8a543dd1538def93567513de
- Mark OLESEN closed
closed
- Michael Orella mentioned in issue #3344 (closed)
mentioned in issue #3344 (closed)