Skip to content

plistlib unable to parse plist comments containing -- #95722

Closed as not planned
Closed as not planned

Description

@bjo0

plistlib unable to parse plist comments containing --.

For example, this is a valid plist comment:

    <!-- --------------------------------- -->

But plist lib throws this error:

xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 11

I think maybe when it sees --, it expects that you are going to close the comment.

Activity

  1. ronaldoussoren commented on Aug 6, 2022

    @ronaldoussoren
    Contributor

    See the XML specification: https://www.w3.org/TR/xml/#sec-comments

    This comment is not well-formed, which is why it is rejected by the XML parser used by plistlib.

  2. ronaldoussoren commented on Aug 7, 2022

    @ronaldoussoren
    Contributor

    I'm closing this issue because this is IMO not a bug in plistlib, but malformed input.

  3. bjo0 commented on Aug 8, 2022

    @bjo0
    Author

    To close the loop, the relevant portion of the document is:

    For compatibility, the string " -- " (double-hyphen) must not occur within comments.] Parameter entity references must not be recognized within comments.

    for compatibility: [Definition: Marks a sentence describing a feature of XML included solely to ensure that XML remains compatible with SGML.]

    Note that Apple's plist parser does permit such comments, so this may be a source of future issues if neither system changes. I have filed a radar with Apple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions