]> 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)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 27 Feb 2026 21:57:05 +0000 (21:57 +0000)
The generator looks for files in the filesystem, and it sometimes fails
on emacs "lock files" which are a symlink. Ignore those.

(cherry picked from commit 469879aa44c4cde5541b98be0a4421ab069c5834)
(cherry picked from commit 92657eea151b08a7619bc104af373329ed86a5d7)
(cherry picked from commit cb27449373c9c19c5b46dcf457658430f1eb72b9)

src/test/generate-sym-test.py

index 7b5ded936c692813f45f70f4849e4fc114d5a1e9..2b4afff63b87bfd0e146d23a41d933d45185cf69 100755 (executable)
@@ -6,6 +6,7 @@
 import os
 import re
 import sys
+from pathlib import Path
 from typing import IO
 
 
@@ -138,7 +139,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("""        {}