]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
generate-sym-test: skip everything that is not a file
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Thu, 19 Feb 2026 12:01:01 +0000 (13:01 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Thu, 19 Feb 2026 14:33:59 +0000 (15:33 +0100)
The generator looks for files in the filesystem, and it sometimes fails
on emacs "lock files" which are a symlink. Ignore those.

src/test/generate-sym-test.py

index 8fcf17528934681402dd8d69e7c26fb0213fd5c2..b8d64d623f04f19e30f151c30ce4109aa71ce690 100755 (executable)
@@ -6,6 +6,7 @@
 import os
 import re
 import sys
+from pathlib import Path
 from typing import IO
 
 
@@ -161,7 +162,10 @@ for dirpath, _, filenames in sorted(os.walk(sys.argv[2])):
     for filename in sorted(filenames):
         if not filename.endswith('.c') and not filename.endswith('.h'):
             continue
-        with open(os.path.join(dirpath, filename), 'r') as f:
+        p = Path(dirpath) / filename
+        if p.is_symlink():
+            continue
+        with p.open('rt') as f:
             process_source_file(f)
 
 print("""        {}