Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Do not move symlink swiftly into the bin directory #365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 26, 2025

Conversation

cmcgee1024
Copy link
Member

@cmcgee1024 cmcgee1024 commented May 25, 2025

If the swiftly that we've found is a symbolic link then there is likely a
sophisticated installation of it, such as with homebrew. Don't copy
that symbolic link to the bin directory in this case, and allow the
external manager to manage swiftly upgrades on its own.

@cmcgee1024
Copy link
Member Author

@swift-ci test macOS

}
}

guard case let cmdAbsolute else { fatalError() }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this guard looks redundant, as the code does not allow for cmdAbsolute to be optional after guard var cmdAbsolute

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is to tighten the var into a let. Perhaps there is a better way to lock the variable down?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code has changed into a different approach and loses this guard statement.

return
}

// Traverse a symbolic link to the real swiftly
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An addition to the comment here explaining why this block might be hit would help; its unclear how swiftly would get in to this situation just from the code.

@cmcgee1024
Copy link
Member Author

@swift-ci test macOS

@cmcgee1024 cmcgee1024 changed the title Traverse any swiftly symlinks before moving the binary to install Do not move symlind swiftly into the bin directory May 26, 2025
@cmcgee1024
Copy link
Member Author

@swift-ci test macOS

@@ -373,10 +373,17 @@ extension Platform {

// We couldn't find ourselves in the usual places. Assume that no installation is necessary
// since we were most likely invoked at SWIFTLY_BIN_DIR already.
guard let cmdAbsolute else {
guard var cmdAbsolute else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is must simpler now; this can be changed back to let and the guard case let cmdAbsolute = cmdAbsolute else { fatalError() } can be removed completely

@cmcgee1024
Copy link
Member Author

@swift-ci test macOS

@cmcgee1024 cmcgee1024 changed the title Do not move symlind swiftly into the bin directory Do not move symlink swiftly into the bin directory May 26, 2025
@cmcgee1024 cmcgee1024 merged commit 5444f46 into swiftlang:main May 26, 2025
24 checks passed
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