Navigation Menu

Skip to content
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

plistlib can't load macOS BigSur system LaunchAgent #85663

Closed
jckwhet mannequin opened this issue Aug 5, 2020 · 9 comments
Closed

plistlib can't load macOS BigSur system LaunchAgent #85663

jckwhet mannequin opened this issue Aug 5, 2020 · 9 comments
Labels
OS-mac type-bug An unexpected behavior, bug, or error

Comments

@jckwhet
Copy link
Mannequin

jckwhet mannequin commented Aug 5, 2020

BPO 41491
Nosy @ronaldoussoren, @ned-deily, @serhiy-storchaka, @miss-islington, @websurfer5
PRs
  • bpo-41491: plistlib: accept hexadecimal integer values in xml plist f… #22764
  • [3.9] bpo-41491: plistlib: accept hexadecimal integer values in xml plist files (GH-22764) #22806
  • [3.8] bpo-41491: plistlib: accept hexadecimal integer values in xml plist files (GH-22764) #22807
  • Files
  • com.apple.cvmsCompAgent_arm64.plist
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-10-20.08:06:18.262>
    created_at = <Date 2020-08-05.22:16:19.025>
    labels = ['OS-mac', 'type-bug']
    title = "plistlib can't load macOS BigSur system LaunchAgent"
    updated_at = <Date 2021-05-06.00:02:55.426>
    user = 'https://bugs.python.org/jckwhet'

    bugs.python.org fields:

    activity = <Date 2021-05-06.00:02:55.426>
    actor = 'AliyevH'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-10-20.08:06:18.262>
    closer = 'ronaldoussoren'
    components = ['macOS']
    creation = <Date 2020-08-05.22:16:19.025>
    creator = 'jckwhet'
    dependencies = []
    files = ['49371']
    hgrepos = []
    issue_num = 41491
    keywords = ['patch']
    message_count = 9.0
    messages = ['374908', '374918', '378945', '378946', '379095', '379098', '379099', '379108', '379111']
    nosy_count = 6.0
    nosy_names = ['ronaldoussoren', 'ned.deily', 'serhiy.storchaka', 'miss-islington', 'Jeffrey.Kintscher', 'jckwhet']
    pr_nums = ['22764', '22806', '22807']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue41491'
    versions = []

    @jckwhet
    Copy link
    Mannequin Author

    jckwhet mannequin commented Aug 5, 2020

    When attempting to load the new LaunchAgent at /System/Library/LaunchAgents/com.apple.cvmsCompAgent3600_arm64.plist plistlib Raises a ValueError of

    File "/opt/salt/lib/python3.7/plistlib.py", line 272, in handle_end_element
    handler()
    File "/opt/salt/lib/python3.7/plistlib.py", line 332, in end_integer
    self.add_object(int(self.get_data()))
    ValueError: invalid literal for int() with base 10: '0x0100000c'

    on

    \<array\>
    	\<integer\>0x0100000c\</integer\>
    \</array\>
    

    Technically this violates the spec at http://www.apple.com/DTDs/PropertyList-1.0.dtd. Figured it was worth reporting.

    Full Plist is attached.

    @jckwhet jckwhet mannequin added OS-mac labels Aug 5, 2020
    @ronaldoussoren
    Copy link
    Contributor

    Please also report this at apple using the feedback assistent.

    @ronaldoussoren
    Copy link
    Contributor

    This file is still present on the latest version of macOS 11 beta on ARM64, with this integer value. Furthermore plutil will happily read this file.

    I'm in favour of changing plistlib to parse files like this.

    @ronaldoussoren
    Copy link
    Contributor

    Given this plist:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"\>
    <plist version="1.0">
    <dict>
    <key>hex</key>
    <array>
    <integer>0x0100000c</integer>
    </array>
    <key>oct</key>
    <array>
    <integer>0123</integer>
    </array>
    </dict>
    </plist>

    plutil -convert json prints:

    {"hex":[16777228],"oct":[123]}

    That is, hexadecimal values are detected and parsed, but "0" as a prefix for octal values (as in C) is not.

    @ronaldoussoren
    Copy link
    Contributor

    New changeset 3185267 by Ronald Oussoren in branch 'master':
    bpo-41491: plistlib: accept hexadecimal integer values in xml plist files (GH-22764)
    3185267

    @ronaldoussoren
    Copy link
    Contributor

    New changeset 3fc7080 by Miss Skeleton (bot) in branch '3.9':
    bpo-41491: plistlib: accept hexadecimal integer values in xml plist files (GH-22764) (GH-22806)
    3fc7080

    @ronaldoussoren
    Copy link
    Contributor

    New changeset d1eb755 by Miss Skeleton (bot) in branch '3.8':
    bpo-41491: plistlib: accept hexadecimal integer values in xml plist files (GH-22764) (GH-22807)
    d1eb755

    @ronaldoussoren ronaldoussoren added the type-bug An unexpected behavior, bug, or error label Oct 20, 2020
    @ronaldoussoren ronaldoussoren added the type-bug An unexpected behavior, bug, or error label Oct 20, 2020
    @serhiy-storchaka
    Copy link
    Member

    Does plutil support octal (0o) and binary (0b) literals?

    @ronaldoussoren
    Copy link
    Contributor

    It doesn't, both 0b101 and 0o101 get rejected as syntax errors.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    OS-mac type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants