-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix: preserve symlinks in ZipArchive compress function #8250
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
Fix: preserve symlinks in ZipArchive compress function #8250
Conversation
@swift-ci test |
Thanks for the review, @MaxDesiatov! Apologies for the failing test on Linux, I'll try to dig into what's going on there and make sure this works cross-platform. |
@MaxDesiatov, I believe I've got this working– there's an issue that seems specific to Ubuntu 20.04 when the symlink in the unit test is at the root of the test's temp directory, but moving it to a subdirectory seems to behave correctly across MacOS and Linux and provides the same coverage for the functionality. |
@swift-ci test |
I hate to be a bother, but any chance someone can re-invoke the tests? Looks like the Windows job never reported its status, but I believe the tests should have passed. |
@swift-ci test Windows |
Thanks! |
This PR fixes swiftlang#8248, by adding the `y` flag to the `zip` command that is executed when archiving a package's sources for publication to a registry on a non-Windows OS. ### Motivation: Without this change, packages which contain symlinks in their sources will produce invalid and potentially non-buildable archives when publishing to a registry, since any symlinks are currently transformed into duplicate files during the archive creation, instead of being preserved. ### Modifications: I've added the following flag to the `zip` call: > -y store symbolic links as the link instead of the referenced file I've additionally modified the associated `testCompress()` test case, adding logic to ensure that symlinks are preserved correctly. ### Result: With this change, the resulting zipfile that is uploaded to a registry will contain symlinks consistent with the original package sources.
This PR fixes #8248, by adding the
y
flag to thezip
command that is executed when archiving a package's sources for publication to a registry on a non-Windows OS.Motivation:
Without this change, packages which contain symlinks in their sources will produce invalid and potentially non-buildable archives when publishing to a registry, since any symlinks are currently transformed into duplicate files during the archive creation, instead of being preserved.
Modifications:
I've added the following flag to the
zip
call:I've additionally modified the associated
testCompress()
test case, adding logic to ensure that symlinks are preserved correctly.Result:
With this change, the resulting zipfile that is uploaded to a registry will contain symlinks consistent with the original package sources.