-
Notifications
You must be signed in to change notification settings - Fork 0
crash when pty.read (size=1024) ends/appears to end in the middle of utf-8 char (?) #1
Description
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.