From 965f7e18fa5aa7c3cdce826ffee03cfdf1c47b18 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Wed, 21 Apr 2021 19:14:55 +0300 Subject: [PATCH] Xcode: fix shell quotings. --- mesonbuild/backend/xcodebackend.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py index 49e75951b..b81b90596 100644 --- a/mesonbuild/backend/xcodebackend.py +++ b/mesonbuild/backend/xcodebackend.py @@ -1114,7 +1114,7 @@ class XCodeBackend(backends.Backend): custom_dict.add_item('runOnlyForDeploymentPostprocessing', 0) custom_dict.add_item('shellPath', '/bin/sh') workdir = self.environment.get_build_dir() - cmdstr = ' '.join([f'\\"{x}\\"' for x in fixed_cmd]) + cmdstr = ' '.join([f"\\'{x}\\'" for x in fixed_cmd]) custom_dict.add_item('shellScript', f'"cd {workdir}; {cmdstr}"') custom_dict.add_item('showEnvVarsInLog', 0) @@ -1494,7 +1494,7 @@ class XCodeBackend(backends.Backend): # b) I don't know why it works or why every backslash must be escaped into eight backslashes a = a.replace(chr(92), 8*chr(92)) # chr(92) is backslash, this how we smuggle it in without Python's quoting grabbing it. a = a.replace(r'"', r'\\\"') - if ' ' in a: + if ' ' in a or "'" in a: a = r'\"' + a + r'\"' quoted_args.append(a) settings_dict.add_item(f'OTHER_{langname}FLAGS', '"' + ' '.join(quoted_args) + '"')