tdryer / hangups

the first third-party instant messaging client for Google Hangouts
https://hangups.readthedocs.io/
MIT License
1.71k stars 189 forks source link

Multiline and unknown character crash #203

Open mathieulavallee opened 8 years ago

mathieulavallee commented 8 years ago

Hi guys,

My girlfriend send me a cut and paste message from official google hangout web client that look like this:

Bonjour,

J'aimerais participer à cet activité de perfectionnement. 
Est-ce que je peux être libérer le 27 janvier ?
9SxIpapi�{3LV

And hangups crashed instantly... after restarting it, and trying to read the message again, i can't see any message from her and all i see is Loading...

I restarted the hangups with log parameter, here is the log:

asyncio - ERROR - Exception in callback AsyncioEventLoop.enter_idle.<locals>.faux_idle_callback() at /usr/local/lib/python3.4/dist-packages/hangups_urwid-1.2.2_dev-py3.4-linux-x86_64.egg/urwid/main_loop.py:1284
handle: <TimerHandle when=369229.179165147 AsyncioEventLoop.enter_idle.<locals>.faux_idle_callback() at /usr/local/lib/python3.4/dist-packages/hangups_urwid-1.2.2_dev-py3.4-linux-x86_64.egg/urwid/main_loop.py:1284>
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/asyncio-3.4.3-py3.4.egg/asyncio/events.py", line 120, in _run
    self._callback(*self._args)
  File "/usr/local/lib/python3.4/dist-packages/hangups_urwid-1.2.2_dev-py3.4-linux-x86_64.egg/urwid/main_loop.py", line 1285, in faux_idle_callback
    callback()
  File "/usr/local/lib/python3.4/dist-packages/hangups_urwid-1.2.2_dev-py3.4-linux-x86_64.egg/urwid/main_loop.py", line 560, in entering_idle
    self.draw_screen()
  File "/usr/local/lib/python3.4/dist-packages/hangups_urwid-1.2.2_dev-py3.4-linux-x86_64.egg/urwid/main_loop.py", line 575, in draw_screen
    self.screen.draw_screen(self.screen_size, canvas)
  File "/usr/local/lib/python3.4/dist-packages/hangups_urwid-1.2.2_dev-py3.4-linux-x86_64.egg/urwid/raw_display.py", line 791, in draw_screen
    assert cs in [None, "0", "U"], repr(cs)
AssertionError: b'0'

I just reinstall hangups using pip3 as follow.

mkdir venv
virtualenv -p /usr/bin/python3 venv
source venv/bin/activate
pip3 install hangups
hangups

edit: i just tried with the source from github, same error, here is the log

asyncio - ERROR - Exception in callback AsyncioEventLoop.enter_idle.<locals>.faux_idle_callback() at /tmp/hangups/venv/lib/python3.4/site-packages/urwid-1.3.1-py3.4-linux-x86_64.egg/urwid/main_loop.py:1288
handle: <TimerHandle when=373806.910484639 AsyncioEventLoop.enter_idle.<locals>.faux_idle_callback() at /tmp/hangups/venv/lib/python3.4/site-packages/urwid-1.3.1-py3.4-linux-x86_64.egg/urwid/main_loop.py:1288>
Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/events.py", line 120, in _run
    self._callback(*self._args)
  File "/tmp/hangups/venv/lib/python3.4/site-packages/urwid-1.3.1-py3.4-linux-x86_64.egg/urwid/main_loop.py", line 1289, in faux_idle_callback
    callback()
  File "/tmp/hangups/venv/lib/python3.4/site-packages/urwid-1.3.1-py3.4-linux-x86_64.egg/urwid/main_loop.py", line 564, in entering_idle
    self.draw_screen()
  File "/tmp/hangups/venv/lib/python3.4/site-packages/urwid-1.3.1-py3.4-linux-x86_64.egg/urwid/main_loop.py", line 579, in draw_screen
    self.screen.draw_screen(self.screen_size, canvas)
  File "/tmp/hangups/venv/lib/python3.4/site-packages/urwid-1.3.1-py3.4-linux-x86_64.egg/urwid/raw_display.py", line 793, in draw_screen
    assert cs in [None, "0", "U"], repr(cs)
AssertionError: b'0'
tdryer commented 8 years ago

The AssertionError suggests that it's a bug in urwid, but I couldn't reproduce the issue outside hangups:

import urwid
import datetime

from hangups.ui.__main__ import MessageWidget

text = '''J'aimerais participer à cet activité de perfectionnement. 
Est-ce que je peux être libérer le 27 janvier ?
9SxIpapi�{3L�V
'''

msg = MessageWidget(datetime.datetime.fromtimestamp(0, datetime.timezone.utc),
                    text, dict(date='', time=''))
fill = urwid.Filler(txt, 'top')
loop = urwid.MainLoop(fill)
loop.run()

However, it's possible that GitHub has sanitized the problem string somehow.