]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: Check if files returned by git ls-files actually exist
authorDaan De Meyer <daan@amutable.com>
Fri, 10 Apr 2026 06:14:53 +0000 (08:14 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 10 Apr 2026 12:34:00 +0000 (14:34 +0200)
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
test/fuzz/meson.build

index 5e01f22d5b41160975dfe8c0281243d162ce900a..1c296073c2996717524c0e65daa472fddf56ee19 100644 (file)
@@ -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',
index 6f9f43a4105f9d97edca85b555306d9f060177ed..d19fda3a02eaa41fa6e0c2218f10a295fbeedb41 100644 (file)
@@ -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))