Skip to content

Conversation

@fortmarek
Copy link

@fortmarek fortmarek commented Nov 24, 2025

The move() method was using exists(sourcePath) which follows symlinks by default. This caused failures when moving a symlink whose target had already been moved, because it would try to follow the symlink to validate the target exists.

Now it uses exists(sourcePath, followSymlink: false) to check if the symlink itself exists, allowing symlinks to be moved even if their targets have been relocated.

This fixes an issue where extracting package archives with symlinks could fail if files were moved in alphabetical order and a target file was moved before its symlink as described in: swiftlang/swift-package-manager#9411

…e existence

The move() method was using exists(sourcePath) which follows symlinks by default.
This caused failures when moving a symlink whose target had already been moved,
because it would try to follow the symlink to validate the target exists.

Now uses exists(sourcePath, followSymlink: false) to check if the symlink itself
exists, allowing symlinks to be moved even if their targets have been relocated.

This fixes an issue where extracting package archives with symlinks could fail
if files were moved in alphabetical order and a target file was moved before
its symlink.

Added test testMoveSymlinkWithMovedTarget() to verify this behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants