bindings: Improve library matching regex

It was incorrectly matching libbacktrace error messages
This commit is contained in:
Gabriel Ferreira
2025-07-26 19:12:44 +02:00
parent 537bd14cff
commit 891995d3d1

View File

@@ -177,7 +177,7 @@ def extract_linked_libraries(library_name: str, prefix: str) -> tuple:
try:
with open(os.path.abspath(library_path), "rb") as f:
linked_libs = re.findall(
b"\x00(lib.*?.%b)" % LIBRARY_EXTENSION.encode("utf-8"), f.read()
b"\x00(lib[^\\x00]*?\\.%b)(?![\\w.])" % LIBRARY_EXTENSION.encode("utf-8"), f.read()
)
except Exception as e:
print(f"Failed to extract libraries used by {library_path} with exception:{e}")