Repository navigation
Conversation
Apple ships some product types with a trailing variant (iPad16,4-A), which DeconstructDevice's regex did not match. SortDevices rebuilds every name from the parsed Device, so those product types came back as 0,0 and kernelcaches were written as kernelcache.release.0,0_0 instead of kernelcache.release.iPad16,3-A_4-A. Parse the optional suffix and carry it through Device.String and the sort key. Names that never matched the regex still collapse to the zero Device.
…list Adds the second DeconstructDevice caller (pkg/xcode ByProductType, which had no test file) and the sort-key rows the first pass left unpinned: strict ordering between two variants of one model, insertion-order independence, and a round trip over the variant-suffixed product types the embedded Xcode device_traits DB actually ships.
The other tests covered paths the fix does not change.
Author
|
The push after the review (af34d1d) is test-only: |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
utils.DeconstructDeviceparsed product types with the regex^([a-zA-Z]+)([0-9]+),([0-9]+)$, which does not match the variant-suffixed product types Apple ships (iPad16,4-A). On no match it returns the zeroDevice.utils.SortDevicesrebuilds every name it is handed from the parsed struct viaDevice.String(), so an unparsed name does not pass through unchanged: it comes back as the literal string"0,0".pkg/infofeeds product types straight intoSortDevices(info.go:629for kernelcache device lists,info.go:479for IPSW folder names), so an iPad Pro M4 kernelcache is written askernelcache.release.0,0_0instead ofkernelcache.release.iPad16,3-A_4-A.pkg/xcode'sByProductType.Lessis the other caller: every variant-suffixed product type sorted as the zeroDevice, soipsw device-listhoisted all 24 of them (iPad14,3-A/B through iPad17,4-A/B indevice_traits.json) to the front of the list.Device.Variantfield and carry it throughString()and the sort key. Names that never matched the regex still collapse to the zeroDevice, unchanged.Tests
TestSortDevicesPreservesVariantSuffixininternal/utils/sort_test.gofails on master (SortDevicesreturns"0,0"for each variant name) and passes with the fix. The package pulls in cgo dependencies that do not build here, so it was run againstsort.goalone;go vetis clean.AI assistance: this bug was found and the fix and tests were drafted with AI tooling in my workflow; the tests and checks above were run as described. I'm responsible for the change and will handle review feedback.