DINKIN / munki

Automatically exported from code.google.com/p/munki
Other
0 stars 0 forks source link

Unicode Character in CFBundleVersion Causes MSU Error #324

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

- Download Whitebox Packages ( 
http://s.sudre.free.fr/Software/files/Packages.dmg )
- Download Fetch ( http://fetchsoftworks.com/fetch/download/ )
- Drag and drop Fetch 5.7.2 (or later) onto Whitebox Packages, creating an 
installation pkg
- munkiimport Fetch.pkg
- makepkginfo -f /Fetch.app
- Replace Fetch's pkginfo's "receipts" key with the "installs" key generated by 
makepkginfo
- Change Fetch's pkginfo's "installs" version_comparison_key to CFBundleVersion
- Install Fetch on a client via munki
- Run /usr/local/munki/managedsoftwareupdate -vvv

What is the expected output?
MSU correctly determines Fetch is installed and exits normally.

What do you see instead?
MSU dies with the following error:
UnicodeEncodeError: 'ascii' codec can't encode character u'\u200b' in position 
0: ordinal not in range(128)

What version of the Munki tools/InstallOSpkg tools are you using?
1.0.0.1864.0

On what version of OS X?
10.9.2

Please provide any additional information below:
- The Fetch license is a file embedded inside the Fetch application, so a 
simple "munkiimport Fetch.app" will result in licensing issues until the 
subsequent MSU run.
- It appears there is a leading Unicode zero width space in Fetch's Info.plist:
$ defaults read /Applications/Fetch.app/Contents/Info CFBundleVersion
\u200b5.7.3
- Even if Fetch.app on disk has CFBundleVersion fixed, there also is an issue 
if Fetch's pkginfo has a Unicode zero width space in the installs key (note the 
pound sign below takes the place of the bad character):

    <key>installs</key>
    <array>
        <dict>
            <key>CFBundleIdentifier</key>
            <string>com.fetchsoftworks.Fetch</string>
            <key>CFBundleName</key>
            <string>Fetch</string>
            <key>CFBundleShortVersionString</key>
            <string>5.7.2 (5H612, Web Store)</string>
            <key>CFBundleVersion</key>
            <string>#5.7.2</string>
            <key>minosversion</key>
            <string>10.5.0</string>
            <key>path</key>
            <string>/Applications/Fetch.app</string>
            <key>type</key>
            <string>application</string>
            <key>version_comparison_key</key>
            <string>CFBundleVersion</string>
        </dict>
    </array>

- Also filed a support request with Fetch Softworks asking them to remove the 
leading character

-----Partial MSU Log When CFBundleVersion in Fetch.app *on disk* has leading 
Unicode zero width space-----
    Our OS version is 10.9.2
    Found Fetch 5, version 5.7.2 in catalog production
        Found Info.plist at /Applications/Fetch.app/Contents/Info.plist
        Checking /Applications/Fetch.app/Contents/Info.plist for CFBundleVersion ​5.7.2...
        Using version_comparison_key CFBundleVersion
        Installed item has version ​5.7.2
ERROR: Unexpected error in updatecheck:
Traceback (most recent call last):
  File "/usr/local/munki/managedsoftwareupdate", line 935, in <module>
    main()
  File "/usr/local/munki/managedsoftwareupdate", line 661, in main
    updatecheckresult = updatecheck.check(client_id=options.id)
  File "/usr/local/munki/munkilib/updatecheck.py", line 2746, in check
    installinfo)
  File "/usr/local/munki/munkilib/updatecheck.py", line 2073, in processManifestForKey
    installinfo)
  File "/usr/local/munki/munkilib/updatecheck.py", line 1769, in processInstall
    installed_state = installedState(item_pl)
  File "/usr/local/munki/munkilib/updatecheck.py", line 1222, in installedState
    comparison = compareItemVersion(item)
  File "/usr/local/munki/munkilib/updatecheck.py", line 645, in compareItemVersion
    return compareApplicationVersion(item)
  File "/usr/local/munki/munkilib/updatecheck.py", line 400, in compareApplicationVersion
    return compareBundleVersion(app)
  File "/usr/local/munki/munkilib/updatecheck.py", line 517, in compareBundleVersion
    compare_result = comparePlistVersion(item)
  File "/usr/local/munki/munkilib/updatecheck.py", line 571, in comparePlistVersion
    compare_result = compareVersions(installedvers, versionstring)
  File "/usr/local/munki/munkilib/updatecheck.py", line 370, in compareVersions
    if (munkicommon.MunkiLooseVersion(thisvers) <
  File "/usr/local/munki/munkilib/munkicommon.py", line 1248, in __init__
    self.parse(str(vstring))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u200b' in position 
0: ordinal not in range(128)

-----Partial MSU Log When CFBundleVersion in Fetch.app *pkginfo* has leading 
Unicode zero width space, but on-disk Fetch has the Unicode zero width space 
removed-----
    Our OS version is 10.9.2
    Found Fetch 5, version 5.7.2 in catalog production
        Found Info.plist at /Applications/Fetch.app/Contents/Info.plist
        Checking /Applications/Fetch.app/Contents/Info.plist for CFBundleVersion ​5.7.2...
        Using version_comparison_key CFBundleVersion
        Installed item has version 5.7.2
ERROR: Unexpected error in updatecheck:
Traceback (most recent call last):
  File "/usr/local/munki/managedsoftwareupdate", line 935, in <module>
    main()
  File "/usr/local/munki/managedsoftwareupdate", line 661, in main
    updatecheckresult = updatecheck.check(client_id=options.id)
  File "/usr/local/munki/munkilib/updatecheck.py", line 2746, in check
    installinfo)
  File "/usr/local/munki/munkilib/updatecheck.py", line 2073, in processManifestForKey
    installinfo)
  File "/usr/local/munki/munkilib/updatecheck.py", line 1769, in processInstall
    installed_state = installedState(item_pl)
  File "/usr/local/munki/munkilib/updatecheck.py", line 1222, in installedState
    comparison = compareItemVersion(item)
  File "/usr/local/munki/munkilib/updatecheck.py", line 645, in compareItemVersion
    return compareApplicationVersion(item)
  File "/usr/local/munki/munkilib/updatecheck.py", line 400, in compareApplicationVersion
    return compareBundleVersion(app)
  File "/usr/local/munki/munkilib/updatecheck.py", line 517, in compareBundleVersion
    compare_result = comparePlistVersion(item)
  File "/usr/local/munki/munkilib/updatecheck.py", line 571, in comparePlistVersion
    compare_result = compareVersions(installedvers, versionstring)
  File "/usr/local/munki/munkilib/updatecheck.py", line 371, in compareVersions
    munkicommon.MunkiLooseVersion(thatvers)):
  File "/usr/local/munki/munkilib/munkicommon.py", line 1248, in __init__
    self.parse(str(vstring))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u200b' in position 
0: ordinal not in range(128)

Original issue reported on code.google.com by fergu...@gmail.com on 30 May 2014 at 9:28

GoogleCodeExporter commented 8 years ago
This commit should address this: 
https://code.google.com/p/munki/source/detail?r=b431eb4d18163c3608d2aac36d9daaf8
86e88b31

Original comment by gregnea...@mac.com on 30 May 2014 at 10:02