From c08d7143e89a642957a8532f36c4c83ae6a5647b Mon Sep 17 00:00:00 2001 From: mloubout Date: Tue, 12 Aug 2025 09:43:32 -0400 Subject: [PATCH] arch: prevent shell string escape in codepy cmdline strings --- devito/arch/compiler.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/devito/arch/compiler.py b/devito/arch/compiler.py index ae4cf92d1f..d6f1c788f8 100644 --- a/devito/arch/compiler.py +++ b/devito/arch/compiler.py @@ -335,6 +335,14 @@ def make(self, loc, args): f'Compile errors in {errfile}\n') debug(f"Make <{' '.join(args)}>") + def _cmdline(self, files, object=False): + """ + Sanitize command line to remove all shell string escape such as + mpicc/mpicxx would add, e.g., `-Wl\\,-rpath,/path/to/lib`. + """ + cc_line = super()._cmdline(files, object=object) + return [s.replace('\\', '') for s in cc_line] + def jit_compile(self, soname, code): """ JIT compile some source code given as a string.