Follow symbolic links during glob expansion#1562
Open
nkakouros wants to merge 1 commit intoapple:mainfrom
Open
Follow symbolic links during glob expansion#1562nkakouros wants to merge 1 commit intoapple:mainfrom
nkakouros wants to merge 1 commit intoapple:mainfrom
Conversation
HT154
approved these changes
Apr 27, 2026
Comment on lines
+9
to
+10
| * Follow symbolic links during `import*` and `read*` glob expansion; symlink cycles now surface as a clear I/O error | ||
| (pr:https://github.com/apple/pkl/pull/XXXX[]). |
Contributor
There was a problem hiding this comment.
No action needed here, but just a note for us when prepping the release: this is a breaking change and we'll need to ensure it's marked accordingly.
cd6e0ec to
6e76106
Compare
FileResolver.listElements() unconditionally skipped all symlinks to prevent cyclical globs from directory symlinks. As a side effect, import*() and read*() silently dropped symlinks to regular files from their results, returning partial output with no warning, and skipped symlinks to directories even when no cycle existed. Stop filtering symlinks. Switch the directory check from Files.isDirectory(), which silently returns false on errors, to Files.readAttributes(), which lets I/O errors propagate. This way the existing OS-level symlink-resolution limit surfaces a clear "Too many levels of symbolic links" error on cycles instead of a silent truncation. Broken symlinks are still surfaced as non-directory entries via a NoSuchFileException catch.
6e76106 to
1940a07
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FileResolver.listElements() unconditionally skipped all symlinks to prevent cyclical globs from directory symlinks. As a side effect, import*() and read*() silently dropped symlinks to regular files from their results, returning partial output with no warning, and skipped symlinks to directories even when no cycle existed.
Stop filtering symlinks. Switch the directory check from Files.isDirectory(), which silently returns false on errors, to Files.readAttributes(), which lets I/O errors propagate. This way the existing OS-level symlink-resolution limit surfaces a clear "Too many levels of symbolic links" error on cycles instead of a silent truncation. Broken symlinks are still surfaced as non-directory entries via a NoSuchFileException catch.
Test on [windows] and [native]