Skip to content
This repository has been archived by the owner on Feb 13, 2020. It is now read-only.

fix non-ascii characters #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mskmkt0704
Copy link
Contributor

non-ascii filename in package will throw UnicodeDecodeError

WARNING:root:Traceback (most recent call last):
  File "/opt/AppSignSrv/app/core/__init__.py", line 285, in resign_app
    isign.resign(original_path, **kwargs)
  File "/root/alamis/miniconda2/envs/appsign.sub.core/lib/python2.7/site-packages/isign/isign.py", line 49, in resign
    info_props)
  File "/root/alamis/miniconda2/envs/appsign.sub.core/lib/python2.7/site-packages/isign/archive.py", line 280, in resign
    bundle.resign(signer, provisioning_profile)
  File "/root/alamis/miniconda2/envs/appsign.sub.core/lib/python2.7/site-packages/isign/bundle.py", line 216, in resign
    super(App, self).resign(signer)
  File "/root/alamis/miniconda2/envs/appsign.sub.core/lib/python2.7/site-packages/isign/bundle.py", line 166, in resign
    self.sign(signer)
  File "/root/alamis/miniconda2/envs/appsign.sub.core/lib/python2.7/site-packages/isign/bundle.py", line 159, in sign
    self.path)
  File "/root/alamis/miniconda2/envs/appsign.sub.core/lib/python2.7/site-packages/isign/code_resources.py", line 226, in make_seal
    return write_plist(target_dir, plist)
  File "/root/alamis/miniconda2/envs/appsign.sub.core/lib/python2.7/site-packages/isign/code_resources.py", line 204, in write_plist
    plistlib.writePlist(plist, fh)
  File "/root/alamis/miniconda2/envs/appsign.sub.core/lib/python2.7/plistlib.py", line 94, in writePlist
    writer.writeValue(rootObject)
  File "/root/alamis/miniconda2/envs/appsign.sub.core/lib/python2.7/site-packages/isign/code_resources.py", line 32, in writeValue
    self.oldWriteValue(value)
  File "/root/alamis/miniconda2/envs/appsign.sub.core/lib/python2.7/plistlib.py", line 252, in writeValue
    self.writeDict(value)
  File "/root/alamis/miniconda2/envs/appsign.sub.core/lib/python2.7/plistlib.py", line 281, in writeDict
    self.writeValue(value)
  File "/root/alamis/miniconda2/envs/appsign.sub.core/lib/python2.7/site-packages/isign/code_resources.py", line 32, in writeValue
    self.oldWriteValue(value)
  File "/root/alamis/miniconda2/envs/appsign.sub.core/lib/python2.7/plistlib.py", line 252, in writeValue
    self.writeDict(value)
  File "/root/alamis/miniconda2/envs/appsign.sub.core/lib/python2.7/plistlib.py", line 280, in writeDict
    self.simpleElement("key", key)
  File "/root/alamis/miniconda2/envs/appsign.sub.core/lib/python2.7/plistlib.py", line 172, in simpleElement
    value = _escapeAndEncode(value)
  File "/root/alamis/miniconda2/envs/appsign.sub.core/lib/python2.7/plistlib.py", line 222, in _escapeAndEncode
    return text.encode("utf-8")             # encode as UTF-8
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 0: ordinal not in range(128)

@neilk
Copy link
Contributor

neilk commented Jun 27, 2016

Okay, this is kind of a bug that we rely on an external zip program, but this causes tests to fail on Mac OS X.

It will fail for anything that involves unzipping, which is any test with an IPA. Example:

======================================================================
ERROR: Extract a resigned app with frameworks, analyze if some expected
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/neilk/projects/isign/tests/isign_base_test.py", line 42, in tearDown
    assert len(remaining_temp_files) == 0
AssertionError:
-------------------- >> begin captured logging << --------------------
isign.archive: DEBUG: got executable /usr/bin/zip for zip
isign.archive: DEBUG: got executable /usr/bin/unzip for unzip
isign.archive: DEBUG: File /Users/neilk/projects/isign/tests/TestWithFrameworks.ipa not matched as <class 'isign.archive.AppZip'>: no app directory found
isign.archive: DEBUG: got executable /usr/bin/zip for zip
isign.archive: DEBUG: got executable /usr/bin/unzip for unzip
isign.archive: DEBUG: this is an archive, and a zipfile
isign.archive: DEBUG: found one app
isign.archive: DEBUG: is_native: True
isign.archive: DEBUG: File /Users/neilk/projects/isign/tests/TestWithFrameworks.ipa matched as Ipa
isign.archive: DEBUG: got executable /usr/bin/unzip for unzip
isign.archive: INFO: Not signable: </Users/neilk/projects/isign/tests/TestWithFrameworks.ipa>: no Info.plist found; probably not a bundle

isign_base_test: ERROR: remaining temp files: isign-kXHtkR, tmphKDtgU
--------------------- >> end captured logging << ---------------------

(You can ignore the stuff about temp files; that warning will occur for any error. The interesting part is the "Not signable" warning.)

I've determined that the target directory doesn't contain any files, so something about -O is messing it up.

Also, I don't see any -O flag that affects encoding for zip 3.0, which is what I have on both Mac OS X El Capitain, and Ubuntu Trusty 14.04.3 LTS. There is a -O that affects output path.

It would be great to have a test case for this. Maybe attach an app to this bug if you can?

@mskmkt0704
Copy link
Contributor Author

i am sorry i just test it in my centos6.7 and it works well. i will try more test for it.

@mskmkt0704 mskmkt0704 closed this Jun 29, 2016
@neilk neilk reopened this Sep 6, 2016
@neilk
Copy link
Contributor

neilk commented Sep 6, 2016

reopening, we should just add a patch to avoid the -O flag on OSX for now.

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

Successfully merging this pull request may close these issues.

3 participants