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

UnicodeDecodeError in unpack_archive when extract_dir is unicode on Python 2 #709

Closed
cjw296 opened this issue Aug 1, 2016 · 6 comments
Closed

Comments

@cjw296
Copy link

@cjw296 cjw296 commented Aug 1, 2016

I see 25.1.2 was release today, and I've just had nightly builds of one of my packages fail as follows:

Installing docs.
Getting distribution for 'sphinx'.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 2271, in main
  File "/opt/python/2.7.9/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/opt/python/2.7.9/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/opt/python/2.7.9/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 409, in run
  File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 645, in easy_install
  File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 694, in install_item
  File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 845, in install_eggs
  File "build/bdist.linux-x86_64/egg/setuptools/archive_util.py", line 52, in unpack_archive
  File "build/bdist.linux-x86_64/egg/setuptools/archive_util.py", line 147, in unpack_tarfile
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/posixpath.py", line 80, in join
    path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xcc in position 8: ordinal not in range(128)
An error occurred when trying to install Sphinx 1.4.5. Look above this message for any errors that were output by easy_install.
While:
  Installing docs.
  Getting distribution for 'sphinx'.
Error: Couldn't install: Sphinx 1.4.5

The full log is here: https://travis-ci.org/cjw296/nose_fixes/jobs/149012793

Any idea when this could be fixed?

@kpayson64
Copy link

@kpayson64 kpayson64 commented Aug 2, 2016

I saw this issue as well.

Loading

@jaraco
Copy link
Member

@jaraco jaraco commented Aug 2, 2016

Here are the changes since 25.1.1. Given the nature of the error and the stack trace that the issue arises from the fix for #704.

Loading

@jaraco
Copy link
Member

@jaraco jaraco commented Aug 2, 2016

I'm able to replicate the failure with easy_install sphinx.

$ ~/.virtualenvs/issue709/bin/python -m easy_install sphinx      
Searching for sphinx
Reading https://pypi.python.org/simple/sphinx/
Downloading https://pypi.python.org/packages/8b/78/eeea2b837f911cdc301f5f05163f9729a2381cadd03ccf35b25afe816c90/Sphinx-1.4.5.tar.gz#md5=5c2cd2dac45dfa6123d067e32a89e89a
Best match: Sphinx 1.4.5
Processing Sphinx-1.4.5.tar.gz
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/jaraco/Dropbox/code/main/setuptools/easy_install.py", line 5, in <module>
    main()
  File "setuptools/command/easy_install.py", line 2271, in main
    **kw
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "setuptools/command/easy_install.py", line 409, in run
    self.easy_install(spec, not self.no_deps)
  File "setuptools/command/easy_install.py", line 664, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "setuptools/command/easy_install.py", line 694, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "setuptools/command/easy_install.py", line 845, in install_eggs
    unpack_archive(dist_filename, tmpdir, self.unpack_progress)
  File "setuptools/archive_util.py", line 52, in unpack_archive
    driver(filename, extract_dir, progress_filter)
  File "setuptools/archive_util.py", line 147, in unpack_tarfile
    prelim_dst = os.path.join(extract_dir, *name.split('/'))
  File "/Users/jaraco/.virtualenvs/issue709/lib/python2.7/posixpath.py", line 73, in join
    path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xcc in position 8: ordinal not in range(128)

Loading

@jaraco jaraco changed the title "UnicodeDecodeError: 'ascii' codec can't decode byte 0xcc in position 8" with 25.1.2 on Python 2 UnicodeDecodeError in unpack_archive when extract_dir is unicode on Python 2 Aug 2, 2016
jaraco added a commit that referenced this issue Aug 2, 2016
@jaraco jaraco closed this in 1b8dc8c Aug 2, 2016
jaraco added a commit that referenced this issue Aug 2, 2016
@jaraco
Copy link
Member

@jaraco jaraco commented Aug 2, 2016

Oh awesome. All but the Python 3.5 unicode tests failed.

Loading

@cjw296
Copy link
Author

@cjw296 cjw296 commented Aug 2, 2016

Any chance the fix for #704 could be reverted until it can be corrected?

Loading

@sileht
Copy link
Contributor

@sileht sileht commented Aug 2, 2016

This have to be revert it also breaks any C extension installed with easy_install (or via setup_requires) see: #712

Loading

sileht added a commit to sileht/setuptools that referenced this issue Aug 2, 2016
This reverts commit 8579495.

As we can see on pypa#709,
this breaks many things (easy_install C extensions, all py3.5 tests,
run with LANG=C).

So instead of fixing in a hurry all new bugs due to this, I propose to
revert this commit until all downsides of this change have been
investigated.
sileht added a commit to sileht/setuptools that referenced this issue Aug 2, 2016
This reverts commit 8579495.

As we can see on pypa#709,
this breaks many things (easy_install C extensions, all py3.5 tests,
run with LANG=C).

So instead of fixing in a hurry all new bugs due to this, I propose to
revert this commit until all downsides of this change have been
investigated.

Related bug: pypa#709
Related bug: pypa#710
Related bug: pypa#712
jaraco added a commit that referenced this issue Aug 2, 2016
jaraco added a commit that referenced this issue Aug 2, 2016
soltanmm-google added a commit to soltanmm-google/grpc that referenced this issue Oct 5, 2016
Now that pypa/setuptools#709 has been
addressed...
jaraco added a commit that referenced this issue Dec 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants