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

FreeBSD / OSX: Process.connections('unix') on python 3 does not properly handle unicode #1029

Closed
giampaolo opened this issue Apr 28, 2017 · 1 comment

Comments

@giampaolo
Copy link
Owner

giampaolo commented Apr 28, 2017

The bug was exercised by the new unittest added here: 161f4fb:

======================================================================
ERROR: test_unicode.TestFSAPIsWithInvalidPath.test_connections
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/vagrant/psutil/psutil/tests/test_unicode.py", line 174, in test_connections
    conn = psutil.Process().connections(kind='unix')[0]
  File "/vagrant/psutil/psutil/__init__.py", line 1217, in connections
    return self._proc.connections(kind)
  File "/vagrant/psutil/psutil/_psbsd.py", line 493, in wrapper
    return fun(self, *args, **kwargs)
  File "/vagrant/psutil/psutil/_psbsd.py", line 721, in connections
    rawlist = cext.proc_connections(self.pid, families, types)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 24: invalid start byte

EDIT - also on OSX:

======================================================================
ERROR: test_unicode.TestFSAPIsWithInvalidPath.test_proc_connections
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/vagrant/psutil/psutil/tests/test_unicode.py", line 161, in test_proc_connections
    conn = psutil.Process().connections(kind='unix')[0]
  File "/vagrant/psutil/psutil/__init__.py", line 1217, in connections
    return self._proc.connections(kind)
  File "/vagrant/psutil/psutil/_psosx.py", line 293, in wrapper
    return fun(self, *args, **kwargs)
  File "/vagrant/psutil/psutil/_psosx.py", line 457, in connections
    rawlist = cext.proc_connections(self.pid, families, types)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 72: invalid start byte
@giampaolo giampaolo changed the title BSD: Process.connections('unix') on python 3 does not handle unicode BSD: Process.connections('unix') on python 3 does not properly handle unicode Apr 28, 2017
giampaolo added a commit that referenced this issue Apr 28, 2017
…erly handle unicode paths and may raise UnicodeDecodeError.
@giampaolo giampaolo changed the title BSD: Process.connections('unix') on python 3 does not properly handle unicode BSD / OSX: Process.connections('unix') on python 3 does not properly handle unicode Apr 28, 2017
@giampaolo giampaolo changed the title BSD / OSX: Process.connections('unix') on python 3 does not properly handle unicode FreeBSD / OSX: Process.connections('unix') on python 3 does not properly handle unicode Apr 30, 2017
@giampaolo
Copy link
Owner Author

I will handle this in #1040 as a bigger task. Closing this out as duplicate.

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

No branches or pull requests

1 participant