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

Strange character in Info.plist file causes problems with packaging automation #2527

Closed
grahampugh opened this issue Jul 10, 2020 · 9 comments

Comments

@grahampugh
Copy link

Describe the bug
There is a strange character in the Info.plist file of Quicksilver.app, on line 220. the string appears empty in some editors, but when pasted into GitHub, the non-printable character appears:

			<key>NSKeyEquivalent</key>
			<dict>
				<key>default</key>
				<string>�</string>
			</dict>

Unfortunately, this character causes parsing of the plist file using python's plistlib module to fail.

This causes the AutoPkg recipe which packages up Quicksilver for import into Mac software enterprise management tools such as Jamf Pro and Munki to fail. See autopkg/homebysix-recipes#297 for more details.

For information, AutoPkg is the most-used solution for automating Mac software management in the enterprise.

I assume this character is an unseen artefact not required for the software to run, and could be safely removed?

To Reproduce
Steps to reproduce the behavior:

  1. Install python 3 on a Mac.
  2. Download and mount the Quicksilver 1.6.1 installer DMG
  3. Run python3.
  4. Run the following commands to induce the error:
>>> import os.path
>>> import plistlib
>>> app = '/Volumes/Quicksilver/Quicksilver.app'
>>> plistpath = os.path.join(app, "Contents", "Info.plist")
>>> with open(plistpath, "rb") as f:
...     info = plistlib.load(f)
... 
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/Library/AutoPkg/Python3/Python.framework/Versions/Current/lib/python3.7/plistlib.py", line 950, in load
    return p.parse(fp)
  File "/Library/AutoPkg/Python3/Python.framework/Versions/Current/lib/python3.7/plistlib.py", line 260, in parse
    self.parser.ParseFile(fileobj)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 220, column 12

Expected behavior
plistlib should be able to read values from Quicksilver.app/Contents/Info.plist.

What version of macOS?
macOS 10.15.5

What version of Quicksilver?
1.6.1

@skurfer
Copy link
Member

skurfer commented Jul 10, 2020

I’d expect that sort of junk from Python 2, but… anyway.

I assume this � character is an unseen artefact not required for the software to run, and could be safely removed?

It’s the character that represents ⎋ (Escape) where it defines the ⌘⎋ shortcut for the “Get Current Selection” service. So it can’t be removed, but there might be another way to represent it. I’ll take a look. Thanks.

@grahampugh
Copy link
Author

For info, AutoPkg uses python 3.7 these days.

@skurfer
Copy link
Member

skurfer commented Jul 11, 2020

I think I was able to fix this. Give this test build a try. It should be identical to the current release, except for that one value in the property list.

It sounds like you might have access to a large number of Macs, so could you do me a favor? Run the test build on a totally clean system and make sure selecting text or a file and hitting ⌘⎋ pulls the selection into Quicksilver? It seems to work on my system, but I want to make sure I’m not benefitting from a cached value somewhere.

@grahampugh
Copy link
Author

grahampugh commented Jul 13, 2020 via email

@skurfer
Copy link
Member

skurfer commented Jul 14, 2020

There are some apps where it doesn’t work, but it sounds like the keystroke was recognized which is the main thing I was worried about. Thanks for checking.

@grahampugh
Copy link
Author

Are there any plans to release this fix? It would be good to prevent AutoPkg from complaining to me every day :)

@skurfer
Copy link
Member

skurfer commented Sep 18, 2020

Actually, we might need to revert the change I made. I noticed ⌘⎋ wasn’t working reliably lately, and I think I see why.

Screen Shot 2020-09-18 at 9 33 16 AM

So maybe it was cached on my system before.

@grahampugh
Copy link
Author

grahampugh commented Sep 18, 2020

This seems to be a specific problem with the plistlib module of python. Apple's APIs don't have the problem.

So long as the version printed on the website https://qsapp.com/download.php is always updated and matches the actual application version, I can live with scraping the website to obtain the version.

EDIT: I've solved the problem by using functionality in python's Foundation module to read the plist.

@skurfer
Copy link
Member

skurfer commented Sep 22, 2020

OK. Sorry I couldn’t be more help. I’m curious about that Foundation module. Can you send me a link?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants