Quote the SU2 executable path in SU2_PY on Linux/macOS (SU2_RUN with spaces) - #2935
Open
nikita-ageev wants to merge 1 commit into
Open
nikita-ageev wants to merge 1 commit into
nikita-ageev wants to merge 1 commit into
Conversation
SU2_RUN containing a space broke SU2_PY on Linux/macOS because the executable path was only quoted on Windows. Quote it in build_command (shlex.quote on POSIX, double quotes on Windows) and pass plain "SU2_XXX config.cfg" strings from the callers.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
SU2_PY/SU2/run/interface.pybuilds the command asos.path.join(SU2_RUN, "SU2_CFD") + " config_CFD.cfg"and runs it withshell=True. The executable path is quoted only on Windows (quote = '"' if sys.platform == "win32" else ""), so on Linux/macOS any SU2_PY script (shape_optimization.py, parallel_computation.py, ...) fails ifSU2_RUNcontains a space.This PR moves the quoting into
build_command: the first word of the command is joined withSU2_RUNand quoted (shlex.quoteon POSIX, double quotes on Windows as before), the callers pass plain"SU2_CFD config_CFD.cfg"strings. The quoted path is then inserted into the MPI template as before (mpirun -n %i %s,srun,SU2_MPI_COMMAND). The module-levelquotevariable is removed; it was not used outsideinterface.py.Reproduction on macOS,
SU2_RUN=".../su2 bin",shape_opt_euler_pyfrom serial_regression.py:With the change and
SU2_RUNcontaining a space,history_project.csvand the optimizer output ofshape_opt_euler_pyare identical to develop with aSU2_RUNwithout spaces. The MPI path was checked withNUMBER_PART=2:mpirun -n 2 '/.../su2 bin/SU2_CFD' config_CFD.cfgruns with 2 ranks. The Windows branch produces the same string as before.Related Work
None found. Separate from #2934 (also SU2_PY).
PR Checklist
pre-commit run --allto format old commits.shape_opt_euler_pypasses unchanged, and the reproduction above (SU2_RUN with a space) fails before and passes after.