Skip to content

Commit 90b011b

Browse files
authored
Merge pull request #1004 from pmattsso/fix-scan-symlink-dirs
fix(sources): skip non-regular files in scan_compiled_extensions
2 parents aec9c9c + fb67992 commit 90b011b

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/fromager/sources.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,10 @@ def scan_compiled_extensions(
865865
logger.debug("file %s has a binary extension suffix", relpath)
866866
issues.append(relpath)
867867
elif suffix not in ignore_suffixes:
868+
# Path.walk() lists symlinks to directories as filenames
869+
# rather than dirnames, causing IsADirectoryError on open().
870+
if not filepath.is_file():
871+
continue
868872
with filepath.open("rb") as f:
869873
header = f.read(_MAGIC_HEADERS_READ)
870874
if header.startswith(magic_headers):

0 commit comments

Comments
 (0)