@@ -111,7 +111,21 @@ def safe_relpath(value, context):
111111 if any (part in ("" , ".." ) for part in normalized .split ("/" )):
112112 raise ValueError (f"Unsafe { context } : invalid path segment." )
113113 return normalized
114-
114+
115+ def _quote_executable_windows (value ):
116+ value = value .strip ()
117+ if value .startswith ('"' ) and value .endswith ('"' ):
118+ return value
119+ return f'"{ value } "'
120+
121+ def _quote_executable_posix (value ):
122+ value = value .strip ()
123+ if (value .startswith ("'" ) and value .endswith ("'" )) or (
124+ value .startswith ('"' ) and value .endswith ('"' )
125+ ):
126+ return value
127+ return shlex .quote (value )
128+
115129MKCONCORE_VER = "22-09-18"
116130
117131SCRIPT_DIR = os .path .dirname (os .path .abspath (__file__ ))
@@ -1136,14 +1150,32 @@ def cleanup_script_files():
11361150 fbuild .write ('cd ..' + "\n " )
11371151 i = i + 1
11381152
1139- #start running source in associated dirs (run and debug scripts)
1140- if concoretype == "posix" :
1141- fdebug .write ('#!/bin/bash' + "\n " )
1142- frun .write ('#!/bin/bash' + "\n " )
1143-
1144-
1145- i = 0
1146- for node in nodes_dict :
1153+ #start running source in associated dirs (run and debug scripts)
1154+ if concoretype == "posix" :
1155+ fdebug .write ('#!/bin/bash' + "\n " )
1156+ frun .write ('#!/bin/bash' + "\n " )
1157+
1158+ # Normalize tool executable quoting once, then reuse existing script templates.
1159+ if concoretype == "windows" :
1160+ PYTHONWIN = _quote_executable_windows (PYTHONWIN )
1161+ CPPWIN = _quote_executable_windows (CPPWIN )
1162+ VWIN = _quote_executable_windows (VWIN )
1163+ JAVACWIN = _quote_executable_windows (JAVACWIN )
1164+ JAVAWIN = _quote_executable_windows (JAVAWIN )
1165+ OCTAVEWIN = _quote_executable_windows (OCTAVEWIN )
1166+ MATLABWIN = _quote_executable_windows (MATLABWIN )
1167+ else :
1168+ PYTHONEXE = _quote_executable_posix (PYTHONEXE )
1169+ CPPEXE = _quote_executable_posix (CPPEXE )
1170+ VEXE = _quote_executable_posix (VEXE )
1171+ JAVACEXE = _quote_executable_posix (JAVACEXE )
1172+ JAVAEXE = _quote_executable_posix (JAVAEXE )
1173+ OCTAVEEXE = _quote_executable_posix (OCTAVEEXE )
1174+ MATLABEXE = _quote_executable_posix (MATLABEXE )
1175+
1176+
1177+ i = 0
1178+ for node in nodes_dict :
11471179 containername ,sourcecode = nodes_dict [node ].split (':' )
11481180 if len (sourcecode )!= 0 :
11491181 dockername ,langext = sourcecode .rsplit ("." , 1 )
0 commit comments