From 20afd5d9ec92504bb688b3f422cc526ccfa788fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Thu, 3 Oct 2024 17:41:56 +0200 Subject: [PATCH 1/3] meson: drop explicit -Wextra meson complains: ../meson.build:73: WARNING: Consider using the built-in warning_level option instead of using "-Wextra". --- meson.build | 1 - 1 file changed, 1 deletion(-) diff --git a/meson.build b/meson.build index 5b391aa..5c50b00 100644 --- a/meson.build +++ b/meson.build @@ -25,7 +25,6 @@ conf.set_quoted('PKGSYSCONFDIR', get_option('sysconfdir')) cc = meson.get_compiler('c') c_args = ''' - -Wextra -Werror=undef -Werror=format=2 -Wformat-security From 0d11f063b2d1c87bcf4ea4b71ba04494db83f1e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Thu, 3 Oct 2024 17:42:11 +0200 Subject: [PATCH 2/3] meson: explicitly check for run_command failure meson complains: WARNING: You should add the boolean check kwarg to the run_command call. It currently defaults to false, but it will default to true in future releases of meson. See also: https://github.com/mesonbuild/meson/issues/9300 --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 5c50b00..afd461d 100644 --- a/meson.build +++ b/meson.build @@ -110,7 +110,7 @@ const char * in_word_set(const char *, @0@); @1@ ''' gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C' -gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path())) +gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()), check: true) gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout()) if cc.compiles(gperf_test) gperf_len_type = 'size_t' From 21f2de87e4613b2edee25c0444a77f762e3f147d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Thu, 3 Oct 2024 17:42:16 +0200 Subject: [PATCH 3/3] meson: use better shellscript argument passing Cherry-pick systemd commit ac3eda34[1] ("meson: use better shellscript argument passing"): Passing potentially arbitrary data into a shellscript is potentially very broken if you do not correctly quote it for use. This quoting must be done as part of the interpretation of the data itself, e.g. python's shlex.quote; simply formatting it into a string with double quotes is NOT sufficient. An alternative is to communicate the data reliably via argv to the shell process, and allow the shell to internally handle it via `"$1"`, which is quote-safe and will expand the data from argv as a single tokenized word. Also silences the following meson deprecation notice: NOTICE: Future-deprecated features used: * 0.55.0: {'ExternalProgram.path'} [1]: https://github.com/systemd/systemd/commit/ac3eda348952687bf2cd9efca86edd77bd7ee52b --- meson.build | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/meson.build b/meson.build index afd461d..b5ffe4c 100644 --- a/meson.build +++ b/meson.build @@ -109,8 +109,7 @@ gperf_test_format = ''' const char * in_word_set(const char *, @0@); @1@ ''' -gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C' -gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()), check: true) +gperf_snippet = run_command('sh', '-c', 'echo foo,bar | "$1" -L ANSI-C', '_', gperf, check: true) gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout()) if cc.compiles(gperf_test) gperf_len_type = 'size_t'