Recent

Author Topic: Suddenly getting errors about parsing entitlements  (Read 3175 times)

MISV

  • Hero Member
  • *****
  • Posts: 772
Suddenly getting errors about parsing entitlements
« on: September 21, 2020, 12:25:06 pm »
Been away half an year from my Mac and seems things stopped working :)

So in commandline I call this:

Code: Pascal  [Select][+][-]
  1. codesign --force --options runtime --timestamp --entitlements "/Volumes/DiskW/projects-cool/MyProduct/osx/shrents/casc-dlv.plist" --sign "MyCompany" "/Volumes/DiskW/projects-cool/MyProduct/osx/final_myproduct-dist/mac-myproduct-files/MyProduct.app"
  2.  

I then get this error:
Quote
Failed to parse entitlements: AMFIUnserializeXML: syntax error near line 1

I have validated the XML. Here is what the file contains:
Code: Pascal  [Select][+][-]
  1. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  2. <plist version="1.0">
  3. <dict>
  4.     <key>com.apple.security.cs.disable-library-validation</key>
  5.     <true/>
  6. </dict>
  7. </plist>                
  8.  

Any ideas? No changes otherwise in my system beyond having updated tools.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Suddenly getting errors about parsing entitlements
« Reply #1 on: September 21, 2020, 01:16:54 pm »
This is the first line of the entitlements files I validated successfully:

Code: XML  [Select][+][-]
  1. <?xml version="1.0" encoding="UTF-8"?>

which seems to be missing from your example... it's line 1.

MISV

  • Hero Member
  • *****
  • Posts: 772
Re: Suddenly getting errors about parsing entitlements
« Reply #2 on: September 22, 2020, 02:31:33 am »
Thank you. I still get the same error though.

MISV

  • Hero Member
  • *****
  • Posts: 772
Re: Suddenly getting errors about parsing entitlements
« Reply #3 on: September 22, 2020, 02:33:34 am »
I think it is broken somehow because no matter what I get that error.

dsiders

  • Hero Member
  • *****
  • Posts: 1045
Re: Suddenly getting errors about parsing entitlements
« Reply #4 on: September 22, 2020, 04:48:38 am »
This is the first line of the entitlements files I validated successfully:

Code: XML  [Select][+][-]
  1. <?xml version="1.0" encoding="UTF-8"?>

which seems to be missing from your example... it's line 1.

Since it references an external public DTD, it should be:

Code: XML  [Select][+][-]
  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3. <plist version="1.0">
  4.   <dict>
  5.     <key>com.apple.security.cs.disable-library-validation</key>
  6.     <true/>
  7.   </dict>
  8. </plist>                
  9.  


Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Suddenly getting errors about parsing entitlements
« Reply #5 on: September 22, 2020, 05:13:21 am »
Thank you. I still get the same error though.

Does:

Code: Bash  [Select][+][-]
  1. plutil /Volumes/DiskW/projects-cool/MyProduct/osx/shrents/casc-dlv.plist

display anything useful?

Apple has this to say about a line 1 syntax error:

Quote
After code signing — but before notarizing — you can verify your app or command line tool has a properly formed XML entitlement property list:

% codesign -d --entitlements :- <path to signed .app or command-line tool>

If the output of this command contains the text bplist00, the executable has a binary property list, which the notary service will reject with an error message like:

Embedded entitlements are invalid: syntax error near line 1
« Last Edit: September 22, 2020, 05:17:56 am by trev »

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Suddenly getting errors about parsing entitlements
« Reply #6 on: September 22, 2020, 05:16:30 am »
Since it references an external public DTD, it should be:

Code: XML  [Select][+][-]
  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3. [...]

I based mine on Apple's own apps eg TextEdit:

Code: XML  [Select][+][-]
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3. <plist version="1.0">
  4. <dict>
  5.         <key>com.apple.application-identifier</key>
  6.         <string>com.apple.TextEdit</string>
  7. [..]
  8. </dict>
  9. </plist>

MISV

  • Hero Member
  • *****
  • Posts: 772
Re: Suddenly getting errors about parsing entitlements
« Reply #7 on: September 22, 2020, 10:07:03 pm »
Sorry for the trouble. I think it was a file encoring issue.

Using TextEdit instead of Lazarus solved it. (Tried copy paste your guys code into the file using both tools. Works when using TextEdit.)

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Suddenly getting errors about parsing entitlements
« Reply #8 on: September 23, 2020, 02:56:11 am »
Ahhhh... maybe a line ending issue? I notice Lazarus defaults to "Unix/Linux" on macOS - see pic.

MISV

  • Hero Member
  • *****
  • Posts: 772
Re: Suddenly getting errors about parsing entitlements
« Reply #9 on: September 23, 2020, 12:32:40 pm »
I can try check... but puzzling to me Apple is not able to handle such things....

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Suddenly getting errors about parsing entitlements
« Reply #10 on: September 23, 2020, 01:57:52 pm »
Oops - macOS uses LF for eols. Classic MacOS used CR.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Suddenly getting errors about parsing entitlements
« Reply #11 on: September 23, 2020, 04:34:38 pm »
Oops - macOS uses LF for eols. Classic MacOS used CR.

Of course. After all MacOS X is, very roughly speaking, a BSD Unix distro ;)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

 

TinyPortal © 2005-2018