This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: plistlib can't load macOS BigSur system LaunchAgent
Type: behavior Stage: resolved
Components: macOS Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Jeffrey.Kintscher, jckwhet, miss-islington, ned.deily, ronaldoussoren, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2020-08-05 22:16 by jckwhet, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
com.apple.cvmsCompAgent_arm64.plist jckwhet, 2020-08-05 22:16
Pull Requests
URL Status Linked Edit
PR 22764 merged ronaldoussoren, 2020-10-19 12:06
PR 22806 merged miss-islington, 2020-10-20 07:26
PR 22807 merged miss-islington, 2020-10-20 07:26
Messages (9)
msg374908 - (view) Author: Wesley Whetstone (jckwhet) Date: 2020-08-05 22:16
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.
msg374918 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-08-06 07:23
Please also report this at apple using the feedback assistent.
msg378945 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-10-19 11:54
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.
msg378946 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-10-19 12:04
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.
msg379095 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-10-20 07:26
New changeset 3185267400be853404f22a1e06bb9fe1210735c7 by Ronald Oussoren in branch 'master':
bpo-41491: plistlib: accept hexadecimal integer values in xml plist files (GH-22764)
https://github.com/python/cpython/commit/3185267400be853404f22a1e06bb9fe1210735c7
msg379098 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-10-20 08:05
New changeset 3fc7080220b8dd2e1b067b3224879133d895ea80 by Miss Skeleton (bot) in branch '3.9':
bpo-41491: plistlib: accept hexadecimal integer values in xml plist files (GH-22764) (GH-22806)
https://github.com/python/cpython/commit/3fc7080220b8dd2e1b067b3224879133d895ea80
msg379099 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-10-20 08:05
New changeset d1eb75585ef4c108732ec815cdc0adef087b1c3e by Miss Skeleton (bot) in branch '3.8':
bpo-41491: plistlib: accept hexadecimal integer values in xml plist files (GH-22764) (GH-22807)
https://github.com/python/cpython/commit/d1eb75585ef4c108732ec815cdc0adef087b1c3e
msg379108 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-10-20 09:03
Does plutil support octal (0o) and binary (0b) literals?
msg379111 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-10-20 10:23
It doesn't, both 0b101 and 0o101 get rejected as syntax errors.
History
Date User Action Args
2022-04-11 14:59:34adminsetgithub: 85663
2021-05-06 00:02:55AliyevHsetfiles: - test_plistlib_plutil.py
2021-05-06 00:02:35AliyevHsetfiles: + test_plistlib_plutil.py
2020-10-20 10:23:19ronaldoussorensetmessages: + msg379111
2020-10-20 09:03:52serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg379108
2020-10-20 08:06:18ronaldoussorensetstatus: open -> closed
resolution: fixed
type: behavior
stage: patch review -> resolved
2020-10-20 08:05:43ronaldoussorensetmessages: + msg379099
2020-10-20 08:05:26ronaldoussorensetmessages: + msg379098
2020-10-20 07:26:55miss-islingtonsetpull_requests: + pull_request21765
2020-10-20 07:26:47miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request21764
2020-10-20 07:26:41ronaldoussorensetmessages: + msg379095
2020-10-19 12:06:17ronaldoussorensetkeywords: + patch
stage: patch review
pull_requests: + pull_request21727
2020-10-19 12:04:34ronaldoussorensetmessages: + msg378946
2020-10-19 11:54:00ronaldoussorensetmessages: + msg378945
2020-08-06 07:23:04ronaldoussorensetmessages: + msg374918
2020-08-05 23:12:43Jeffrey.Kintschersetnosy: + Jeffrey.Kintscher
2020-08-05 22:17:34jckwhetsetnosy: + ned.deily, ronaldoussoren
components: + macOS
2020-08-05 22:16:19jckwhetcreate