-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
-parseable-output being dumped by driver or SPM with non-traditional package layout. #5482
Comments
More info; not sure if it's related, but it seems similar: Even with a more traditional structure as seen here, an extra comma in the Package file can produce output like this:
|
Citing #5505 (comment), yes. In that thread, I showed a way to reproduce and bisect the bug. It's too lengthy to put in this issue, though, and may be irrelevant. That's why I put it in the other issue. |
@dabrahams this is indeed a separate issue and iirc was already fixed in 5.7 |
Tracked by rdar://93982172. Thanks for the detailed information on how to repro! I wasn't able to do so earlier when this was being discussed in the Slack thread, but will try again with these instructions. |
Oh I do see it now! Either I was doing it wrong before, or was testing with the wrong version. Thanks! |
I thought we had quashed this one. The problem is that because there are no changes to the structure,
which means that And yet llbuild decided that it needs to invoke a Swift compiler anyway, and so when It seems to me that the parsing of Swift output needs to be made more robust here — SwiftPM shouldn't have had to create a build description in order to properly deal with Swift output from llbuild. Looking at the code here to see what the minimal risk fix would be, since this should/needs to also go into 5.7. |
Note that this happens in the
which is before it even tries to load the build description. |
We looked at this before, and the mystery is why it tried to compile Swift sources when just trying to create the structure. I don't recall the details but I think one of the problems was that there wasn't a reproducible case, IIRC, means that it was just reading through code to guess what happened and why. |
So:
|
The
in this manifest, and "/private/tmp/ArrayOfOptional/" is defined as:
The other two files exist. So there should be no work to be done here. The |
Stepping through llbuild to see if the |
Actually, that doesn't look like it. That just affects the scanning for updates. Here the trace file indicates that llbuild thinks that this rule has never been run before. The question is rather why it then proceeds to create rules from the Swift files it finds. |
@dmbryson, quick question: when a node is marked |
@dabrahams In terms of workaround, I think one would be to use the |
@abertelrud of course I prefer out-of-tree builds anyway, but if you're telling me support for that is buggy, I guess I don't want to chance it. |
@abertelrud directory structure recursively scans and requests nodes within it. So yes, anything in there that is a produced node will be triggered for scanning and production (if needed). |
I just briefly found the parseable output bug on Swift-Colab. I thought I had worked around it, but maybe I triggered a rare edge case. Swift-Colab currently has the workaround where you delete and re-create the only Swift file in the strangely shaped package. However, this happened:
Repeating steps 5 and 6 any number of times does not get the JSON blob to show again. I do not think it behaved this way in my previous example (#5482 (comment)), but I'll have to double-check. Either way, the fact that it bypassed my workaround is strange. |
No, sorry, I was unclear: putting the build directory outside of the source directory should be robust. What I meant to do was to acknowledge that SwiftPM should be able to handle either case (i.e. there is definitely a SwiftPM bug here to fix) but in the meantime a robust workaround should be to use |
Thanks for confirming. So in this case I think probably an llbuild fix will be needed in order to fix this (specifically to allow a content filter to be applied so that the build folder isn't consider part of the sources). |
Thanks a lot for the detailed description. Just to make sure I understand correctly, it sounds as if this happens on the first build after switching the toolchains? |
@abertelrud yes, it happened on the first build. Please let me know if you find any workarounds for that. Even if you fix the bug in Swift 5.8, it won't be fixed on older toolchains. I would like to implement a workaround (if any) into Swift-Colab v2.2 along with several other patches to the kernel's build system. |
I found a third reproducer for the bug. Colab notebook: https://colab.research.google.com/drive/1F6pDngus2tw2I1EYntcgVn2OAc9Eonht?usp=sharing I force-deleted the "checkouts" directory of ".build", then called "swift build" again with the same build flags. SwiftPM then correctly failed. But then, I ran "swift build" a third time and the massive JSON blob was output. Even wierder, the build proceeded to completion the third time! |
I ran the test from #5505 using the 2022-08-06 snapshot, and the JSON blob did not appear. I then switched toolchains to the 2022-08-09 snapshot, and the JSON blob did not appear. For reference, the JSON did appear when I started with the release 5.5.2 toolchain, so I was testing it correctly. |
Describe the bug
Sometimes I see JSON output from SPM when invoking
swift test
.To Reproduce
Get v. 0.1.0 of https://github.com/loftware/ArrayOfOptional (it is tagged)
Go into ArrayOfOptional.swift and change the line
to
rm -rf .build .swiftpm
swift test
; I get normal output as expected belowswift test
again; observe embedded jsonExpected behavior
Environment (please complete the following information):
Additional context
Can't reproduce this with a traditional project structure, e.g. this branch: https://github.com/loftware/ArrayOfOptional/tree/traditional-project-structure. Follow the same steps; no JSON.
However, the
at the end of the build output is confusing and suspicious.
The text was updated successfully, but these errors were encountered: