From 8355eb6e1109b91654363fae01b903735895c295 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Fri, 10 Apr 2026 08:14:53 +0200 Subject: [PATCH] meson: Check if files returned by git ls-files actually exist Otherwise you run into errors such as: """ ../meson.build:2899:28: ERROR: File src/test/test-loop-util.c does not exist. """ when deleting a file in git without staging the deletion. --- meson.build | 8 +++++++- test/fuzz/meson.build | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 5e01f22d5b4..1c296073c29 100644 --- a/meson.build +++ b/meson.build @@ -2896,7 +2896,13 @@ if git.found() 'ls-files', ':/*.[ch]', ':/*.cc', check : false) if all_files.returncode() == 0 - all_files = files(all_files.stdout().split()) + existing_files = [] + foreach f : all_files.stdout().split() + if fs.exists(f) + existing_files += f + endif + endforeach + all_files = files(existing_files) custom_target( output : 'tags', diff --git a/test/fuzz/meson.build b/test/fuzz/meson.build index 6f9f43a4105..d19fda3a02e 100644 --- a/test/fuzz/meson.build +++ b/test/fuzz/meson.build @@ -51,7 +51,7 @@ foreach p : out.stdout().split() # # Also, backslashes get mangled, so skip test. See # https://github.com/mesonbuild/meson/issues/1564. - if p.contains('\\') + if p.contains('\\') or not fs.exists(p) continue endif fuzzer = fs.name(fs.parent(p)) -- 2.47.3