Open dirk68-fu opened 4 weeks ago
Sorry about that! Would you like to contribute or a fix, or would you prefer that I create one?
Hi Paul, Thank you for your great work in the Swift community. I just started trying out Ignite and do not feel confident enough yet to supply a fix for the issue.
That's okay! I've put it on my todo list and will get it done 👍
Hmm… I'm wondering whether there's a very specific situation that triggers this – it seems to correctly bail out once the path has been searched extensively. Can you trace the problem through on your end and see what the flow is? From what I can see, the loop should exit when while currentURL.path().isEmpty == false
fails.
Hi Paul.
It never gets empty. I set a breakpoint after the repeat:
(lldb) po currentURL.path()
"/Users/"
(lldb) po currentURL.path()
"/"
(lldb) po currentURL.path()
"/../"
(lldb) po currentURL.path()
"/../../"
and strangely:
po URL("/").deletingLastPathComponent()
▿ /../
- _url : /../
Paul @twostraws, I found this bug during PublishingContext.empty
implementation. I am not sure what was wrong, but the commit that fixed this issue presents two changes in the PublishingContextKey
:
32. var url = URL("")
changed to
32. var url = URL("https://example.com")
and
49. PublishingContext(for: EmptySite(), from: "")
changed to
49. try! PublishingContext(for: EmptySite(), rootURL: URL.documentsDirectory).
Maybe this second line had something to do with it.
The problem seems to be that URL.packageDirectory(from file:)
searches upwards for Package.swift
and breaking the loop if it finds it or if the search path is empty. But it never gets empty after "/"
as shown above.
If the extension
URL.packageDirectory(from file:)
can't find a file Package.swift in any parent directory it runs into an infinite loop. Hanging the whole publishing process before it even startet.