From bb9f60624b27041805ca87a48f9a4196afb84ccc Mon Sep 17 00:00:00 2001 From: Ting-Wei Lan Date: Mon, 8 Oct 2018 23:44:33 +0800 Subject: [PATCH] gnome: Quote arguments passed to gtkdoc-scangobj It is possible for compiler flags to include special characters, such as double quotes which are needed to define macros with -D options. Since gtkdoc-scangobj uses shlex.split to split arguments passed to --cc, --ld, --cflags, --ldflags into lists, we can safely use shlex.quote to properly quote arguments for these options. --- mesonbuild/modules/gnome.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 1c2f034d6..0d1c22f32 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -17,6 +17,7 @@ functionality such as gobject-introspection, gresources and gtk-doc''' import os import copy +import shlex import subprocess from .. import build @@ -1034,12 +1035,12 @@ This will become a hard error in the future.''') ldflags.update(compiler_flags[1]) ldflags.update(compiler_flags[2]) if compiler: - args += ['--cc=%s' % ' '.join(compiler.get_exelist())] - args += ['--ld=%s' % ' '.join(compiler.get_linker_exelist())] + args += ['--cc=%s' % ' '.join([shlex.quote(x) for x in compiler.get_exelist()])] + args += ['--ld=%s' % ' '.join([shlex.quote(x) for x in compiler.get_linker_exelist()])] if cflags: - args += ['--cflags=%s' % ' '.join(cflags)] + args += ['--cflags=%s' % ' '.join([shlex.quote(x) for x in cflags])] if ldflags: - args += ['--ldflags=%s' % ' '.join(ldflags)] + args += ['--ldflags=%s' % ' '.join([shlex.quote(x) for x in ldflags])] return args