Skip to content
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

[SR-8380] Crash when a dependency depends on itself (cycle) #5346

Closed
swift-ci opened this issue Jul 26, 2018 · 5 comments
Closed

[SR-8380] Crash when a dependency depends on itself (cycle) #5346

swift-ci opened this issue Jul 26, 2018 · 5 comments
Labels

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-8380
Radar rdar://problem/42625957
Original Reporter helge (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate

Attachment: Download

Environment

Xcode 10b4, Swift 4.2 on the command line

10.13.6 (17G65)

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: aac2eb4869d10b7cc4d885ba0ec82d73

relates to:

  • SR-7979 Circular Dependency in SwiftPM Causes Segfault
  • SR-7386 switching between similar packages breaks swift package update

Issue Description:

When trying to build the SwiftNIO_XcodeImage w/ Xcode 10b4, SwiftPM segfaults:

/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc --driver-mode=swift -L /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/4 -lPackageDescription -suppress-warnings -swift-version 4 -I /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/4 -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk /private/tmp/TemporaryFile.mFfdeE.swift -fileno 6
Segmentation fault: 11

Turns out that this is because the `Package.swift` contains GH dependencies which got moved to a new organisation:

-        .package(url: "https://github.com/NozeIO/swift-nio-redis.git", 
-                 from: "0.8.3"),
-        .package(url: "https://github.com/NozeIO/swift-nio-irc.git", 
-                 from: "0.5.0"),
+        .package(url: "https://github.com/SwiftNIOExtras/swift-nio-redis.git", 
+                 from: "0.9.0"),
+        .package(url: "https://github.com/SwiftNIOExtras/swift-nio-irc.git", 
+                 from: "0.6.0"),

When I fix this the URLs, it works. So presumably something is getting confused when GH redirects the old URL to the new location.

You should be able to reproduce this by checking out commit `43ae40d931ae957a7f17997f91a94e0509468a6e` of https://github.com/SwiftXcode/SwiftNIO_XcodeImage.git, and then run `swift build`.

@ankitspd
Copy link
Member

@swift-ci create

@ankitspd
Copy link
Member

This happens because one of the dependency is NozeIO/swift-nio-irc, which redirects to NozeIO/swift-nio-irc-client and it contains a dependency SwiftNIOExtras/swift-nio-irc. This should be fixed once we expand the package identity to include the username instead of just the basename.

@ankitspd
Copy link
Member

This bug also revealed another issue of detecting dependency cycles. It looks like if a dependency depends on itself, we see a similar crash. I was able to create a self contained reproducer.

@swift-ci
Copy link
Contributor Author

Comment by Helge Heß (JIRA)

> NozeIO/swift-nio-irc, which redirects to NozeIO/swift-nio-irc-client

That would be a GitHub bug. `NozeIO/swift-nio-irc` should redirect to `SwiftNIOExtras/swift-nio-irc` (the new org I moved it to). The new `NozeIO/swift-nio-irc-client` is a fork of the (moved) `SwiftNIOExtras/swift-nio-irc`.

(I know all this is an edge case, but people do weird stuff like that 😉 )

@ankitspd
Copy link
Member

We already have separate bugs for both problems hit in this bug report.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants