Skip to content

Commit 0d6197b

Browse files
authored
Merge pull request #2715 from devitocodes/fix-codepy-cmdline
arch: prevent shell string escape in codepy cmdline strings
2 parents f52cf7b + c08d714 commit 0d6197b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

devito/arch/compiler.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,14 @@ def make(self, loc, args):
335335
f'Compile errors in {errfile}\n')
336336
debug(f"Make <{' '.join(args)}>")
337337

338+
def _cmdline(self, files, object=False):
339+
"""
340+
Sanitize command line to remove all shell string escape such as
341+
mpicc/mpicxx would add, e.g., `-Wl\\,-rpath,/path/to/lib`.
342+
"""
343+
cc_line = super()._cmdline(files, object=object)
344+
return [s.replace('\\', '') for s in cc_line]
345+
338346
def jit_compile(self, soname, code):
339347
"""
340348
JIT compile some source code given as a string.

0 commit comments

Comments
 (0)