Better parity with macOS XML plist parsing #37
Merged
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.
This PR intends to bring this library in better alignment with macOS's plist parsing (e.g. plutil, PlistBuddy). This stems from some discussion on the MacAdmins Slack where MDM commands successfully parsed by this library were rejected by macOS's plist parser.
There's two commits:
plutil -lint
$PATH
, the test will use the actual command to compare parse errors. Otherwise it will use a pre-baked list of invalid plists<plist>
,<dict>
, and<array>
tags, so that extraneous tags or chardata returns an error like plutil doesIt should be noted that it's not possible to gain full parity with plutil. For example an malformed DOCTYPE like
<!DOCTYPE PUBLIC "-//Apple//DTD PLIST>
will be happily parsed by plutil, but Go's XML parser will go to EOF looking for the missing
"
, with no control to stop it.However, this PR should bring us to much closer parity than we are now, and it seems to me it's better to have this parser be more stringent than plutil, instead of the other way around.