Skip to content

swift package-registry publish incorrectly handles packages containing symlinks #8248

@sphanley

Description

@sphanley

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.

Description

I'm trying to push certain open-source packages to a Swift Package Registry, but am having an unexpected issue when trying to publish the realm-swift library. Within the realm-swift sources, there's a directory containing a large number of symlinks. However, when I run swift package-registry publish realm.realm-swift {version}, the resulting archive is not buildable when unarchived.

Expected behavior

I would expect that after publishing a package such as realm-swift to my registry, I should be able to resolve and build it successfully.

Actual behavior

In reality, it appears that the archiving logic does not preserve symlinks in package sources, but instead overwrites them with copies of the referenced file, which is causing errors such as duplicate interface definition for class and property has a previous declaration when trying to resolve and build the realm-swift package from the registry.

Steps to reproduce

To reproduce this issue, you can clone the realm-swift repository, and use swift package-registry publish to push it to a Swift registry. Unzipping the resulting archive will show that the symlinks are not preserved as would be needed for proper usability of the package.

Swift Package Manager version/commit hash

Swift Package Manager - Swift 6.0.2-dev

Swift & OS version (output of swift --version ; uname -a)

swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
Target: arm64-apple-macosx14.0
Darwin [hostname redacted] 23.6.0 Darwin Kernel Version 23.6.0: Wed Jul 31 20:49:39 PDT 2024; root:xnu-10063.141.1.700.5~1/RELEASE_ARM64_T6000 arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions