[medium] fix: [brctl] container values containing a space are silently truncated to their first word - #253
Open
elhoim wants to merge 1 commit into
Open
Conversation
…he first space Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
elhoim
force-pushed
the
fix/brctl-value-truncation
branch
from
September 9, 2026 07:30
8f4d3df to
95c6ca4
Compare
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.
BLUF
BrctlParser.parselistfile()matches container values with([^ \[]+|\[[^\]]*\]), which stops at the first space. Realbrctl-container-list.txtvalues are single-quoted and routinely contain spaces, so they are silently truncated.localizedName:'iCloud Drive'is parsed as'iCloud.clients: com.apple.passd, com.apple.PassbookUIService, com.apple.Passbookis parsed ascom.apple.passd,— two of the three clients are dropped, and a trailing comma is kept."localizedName": "'Wallet'"), because.strip("[]")does not strip'.Mobile Documents→Mobile_Documentssubstitution is a workaround for this same bug — a targeted patch for the one path that was noticed. It only ever covered that single literal; any other space-bearing value was left broken.clientsto the end of the line. TheMobile_Documentsround-trip is then unnecessary and is removed.brctl.py, plus a regression test built from real sample lines.Before / after, on the iOS 16 test archive
mainlocalizedName'Wallet'WalletlocalizedName(CloudDocs)'iCloudiCloud Driveclientscom.apple.passd,com.apple.passd, com.apple.PassbookUIService, com.apple.PassbookdocumentsThe fix
Three value shapes are matched explicitly — single-quoted (may contain spaces), bracketed, bare token — and
clientsis taken to the end of the line because it is both space- and comma-separated.Note on the output schema
localizedNameanddocumentsno longer carry surrounding'characters, andclientsnow holds the full list rather than its first entry. Both are corrections of truncated/garbled values rather than new fields, but they do change the emitted strings, so this is worth a deliberate look during review.Test
test_parselistfile_keeps_values_containing_spacesuses two verbatim lines from the iOS 16 archive and asserts the space-bearinglocalizedName, the fulldocumentspath, and the completeclientslist.Verified to fail on
mainwithAssertionError: 'Wallet' != "'Wallet'"and pass with this change. The existingtest_parsebrctlis unaffected.