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

crash when pty.read (size=1024) ends/appears to end in the middle of utf-8 char (?) #1

Open
1 of 2 tasks
dt-rush opened this issue Dec 7, 2017 · 0 comments
Open
1 of 2 tasks
Labels

Comments

@dt-rush
Copy link
Owner

dt-rush commented Dec 7, 2017

The issue title appears to be a fair description of what caused the error.

Sample:

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/local/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/npayne/.local/lib/python2.7/site-packages/pysshlm-1.0.0-py2.7.egg/pysshlm/thin_wrapper.py", line 251, in flow_output
    s = self.pty.read (size=1024)
  File "build/bdist.linux-x86_64/egg/ptyprocess/ptyprocess.py", line 812, in read
    return self.decoder.decode(b, final=False)
  File "/usr/local/lib/python2.7/codecs.py", line 296, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe2 in position 98: invalid continuation byte

This occurred when attempting to cat an sqlite3 .db file, so it's unlikely that it was a case of landing in the middle of a UTF8 sequence, actually it's unclear if landing in the middle would fail or if the reader buffers full UTF8 chars.

At any rate, in this case, the reader was fooled by the .db file's binary data.

Actions needed:

  • a review of the flow_output() function's behaviour when reaching the middle of a UTF8 sequence

  • immediately fix the fact that an exception in flow_output() throws the whole terminal into an unrecoverable state (catch the exception?) 72378eac19fca7ec2e2cc13723adc5044d244e5c

The problem file is attached as .txt since github filters .db. Rename it upon download if you like.

problem_file.txt

@dt-rush dt-rush self-assigned this Dec 8, 2017
@dt-rush dt-rush added the bug label May 3, 2018
@dt-rush dt-rush removed their assignment May 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant