queue: skip a source file that a landing moves or rewrites mid-scan instead of crashing next_functions

This commit is contained in:
KeelrLeek committed 2026-10-06 13:15:05 -05:00
1 parent 9c74b17943
commit 1025c612b2
1 file changed
+6 -2
+6 -2
View File
@@ -47,8 +47,12 @@ class FunctionQueue:
m = re.match(r"([0-9A-F]{6,8})_", path.name)
if not m:
continue
with path.open(encoding="utf-8", errors="replace") as f:
head = [next(f, "") for _ in range(8)]
try:
with path.open(encoding="utf-8", errors="replace") as f:
head = [next(f, "") for _ in range(8)]
except (FileNotFoundError, PermissionError):
continue # a landing on main moved or rewrote it while we scanned; its new path is found
status = "readable" if any(line.startswith(READABLE) for line in head) else \
next((line.split("status:", 1)[1].strip() for line in head if "status:" in line), "raw")
out[int(m.group(1), 16)] = (status, path.name)