JezerM / web-greeter

A modern, visually appealing greeter for LightDM.
https://web-greeter-page.vercel.app
GNU General Public License v3.0
216 stars 12 forks source link

Exception in LightDMLayout #43

Open vantu5z opened 2 years ago

vantu5z commented 2 years ago

Environment

Bug description

Try to run: web-greeter --no-sandbox And get exception:

Traceback (most recent call last):
  File "/usr/lib/web-greeter/bridge/Greeter.py", line 259, in layouts
    return [layout_to_dict(layout) for layout in LightDM.get_layouts()]
  File "/usr/lib/web-greeter/bridge/Greeter.py", line 259, in <listcomp>q
    return [layout_to_dict(layout) for layout in LightDM.get_layouts()]
  File "/usr/lib/web-greeter/bridge/__init__.py", line 48, in layout_to_dict
    "short_description": layout.get_short_description()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 8: unexpected end of data

Fast workaround to fix issue

Edit file: /usr/lib/web-greeter/bridge/__init__.py

def layout_to_dict(layout):
    """Returns a dict from LightDMLayout object"""
    if not layout:
        return {}
    try:
        return {
            "description": layout.get_description(),
            "name": layout.get_name(),
            "short_description": layout.get_short_description()
        }
    except:
        return {}

Additional info

Make some tests. Get exception on my phonetic and custom layouts if run with ru_RU.utf8 locale. So if run LANG=en_US.utf8 web-greeter it works fine.

JezerM commented 2 years ago

Hmm, I didn't expect and even didn't know about these methods throwing an error before. I just added a try-catch around these methods, so it should be fixed now. However, it's weird how this is happening.

Also, I can't reproduce the issue with the Additional info when doing LANG=ru_RU.utf8 web-greeter --debug --no-sandbox; actually, it works fine as you can see here:

Screenshot_20220526_075819

Does this happen only with custom layouts in /etc/lightdm/web-greeter.yml? If so, which layouts are you trying to set? Also, does this occur with other lightdm greeters?

vantu5z commented 2 years ago

Does this happen only with custom layouts in /etc/lightdm/web-greeter.yml? If so, which layouts are you trying to set?

It happens with default layouts in /etc/lightdm/web-greeter.yml. Try leave only us and set another combinations - have no effect.

Also, does this occur with other lightdm greeters?

Before I use gtk-greeter, then switch to webkit2 - all works fine.

Hmm, I didn't expect and even didn't know about these methods throwing an error before. I just added a try-catch around these methods, so it should be fixed now. However, it's weird how this is happening.

Thanks, it should be fixed now. However, cause stay unknown.

JezerM commented 2 years ago

Thanks, it should be fixed now. However, cause stay unknown.

Yeah, it's a weird problem. It might be related to PyGObject as lightdm-gtk-greeter doesn't throw this error (as you say).