sourcing etc/bashrc breaks with aliases
If cd
is an alias, the new sourcing mechanism breaks.
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
- Admin Mentioned in commit ab55e6d00aa03ae3947df5262adb992830e93c16
Mentioned in commit ab55e6d00aa03ae3947df5262adb992830e93c16
By Andrew Heather on 2016-10-28T13:56:23 (imported from GitLab project)
- Mark OLESEN Mentioned in commit ac0a67da56630a731659050da2ffbfe91427a228
Mentioned in commit ac0a67da56630a731659050da2ffbfe91427a228
- Author Maintainer
Still no easy way to have proper behaviour when sourced with a local directory path. Nonetheless, it should at least use the fallback value, which it currently doesn't:
. etc/bashrc bash: cd: etc/bashrc: Not a directory bash: /OpenFOAM-plus/etc/config.sh/functions: No such file or directory bash: /OpenFOAM-plus/bin/foamEtcFile: No such file or directory
- Maintainer
I've got a couple of bug reports related to this on the OpenFOAM Foundation bug tracker:
-
http://bugs.openfoam.org/view.php?id=2311 - see proposed FAQ no.2, regarding how aliases and other shell environment variables can break OpenFOAM's scripting.
- edit: Forgot to mention that the reason why backslash has been dropped out from the Foundation's script stack was because having to circumvent every single possible breaking point can potentially lead to madness... because all shell commands are susceptible to aliases - including
export
- therefore backslashes can end up becoming the most commonly used character in all scripts... so missing one or attempting to catch all of them can be rather distressing... - that said, using backslashes inside
Allrun
and similar scripts shouldn't be as regularly necessary, since aliases usually aren't expanded on these scripts... although functions might still be carried into these scripts and breaking things...
- edit: Forgot to mention that the reason why backslash has been dropped out from the Foundation's script stack was because having to circumvent every single possible breaking point can potentially lead to madness... because all shell commands are susceptible to aliases - including
-
http://bugs.openfoam.org/view.php?id=2310 - "Sourcing etc/bashrc locally leads to problems"
By Bruno Santos on 2016-10-29T21:53:03 (imported from GitLab project)
Edited by Admin -
- Author Maintainer
@wyldckat Some essential information is attached to commit ac0a67da566 . As mentioned there, prefixing with
export
is a problem. To see what I mean, try the following examples,export foo=$(cd bad-path && pwd -P) && echo good || echo bad > bash: cd: bad-path: No such file or directory > good
This corresponds to what was introduced (https://github.com/OpenFOAM/OpenFOAM-dev/commit/4114a1e2bf85ec33024f51b230bb1cd7a97f6f32#diff-8c9763bf3ae7a0b4f5097499edda015bR43), as opposed to what should have been there:
foo=$(cd bad-path && pwd -P) && echo good || echo bad > bash: cd: bad-path: No such file or directory > bad
The
export
follows as a separate attribute afterward, as in commit ac0a67da566. Of course it is possible to leave the export prefix on the fallback values, but since the separate export is needed for the bash-only construct, it is cleaner and more consistent to eliminate them as well. - Maintainer
@mark Many thanks! I knew that the if-then-else chain was still broken, but I didn't properly read your description on commit ac0a67da nor did I see the usage of
export
later on.Although there is one extra check that should be made, which I ended up forgetting to give a patch for, which should be done after all of this automation: if the path isn't fully legit, then the
bashrc
script should warn us about it. Automation is nice and all, but leaving it working without a final check is somewhat reckless...By Bruno Santos on 2016-10-31T12:24:11 (imported from GitLab project)
- Mark OLESEN Mentioned in commit c0801b8eb86f44b7fe04355562f3a26347d56278
Mentioned in commit c0801b8eb86f44b7fe04355562f3a26347d56278
- Admin Status changed to closed by commit ab55e6d00aa03ae3947df5262adb992830e93c16
Status changed to closed by commit ab55e6d00aa03ae3947df5262adb992830e93c16
By Andrew Heather on 2016-12-23T12:39:42 (imported from GitLab project)