evennia / evennia

Python MUD/MUX/MUSH/MU* development system

Home Page:http://www.evennia.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] SSH is broken due to an undefined color variable

iijj22gg opened this issue · comments

Describe the bug

It is currently impossible to connect to Evennia over SSH because the value self.protocol_flags is undefined in the code and just throws an error when trying to open the shell.

# Set color defaults
for color in ("ANSI", "XTERM256", "TRUECOLOR"):
    self.protocol_flags[color] = True

A bandaid fix is easy, simply by defining self.protocol_flags as a dict anywhere before it in the class:

# Set color defaults
self.protocol_flags = {}
for color in ("ANSI", "XTERM256", "TRUECOLOR"):
    self.protocol_flags[color] = True

Or, if self.protocol_flags is actually supposed to hold value in some scenario:

# Set color defaults
if !self.protocol_flags:
    self.protocol_flags = {}
for color in ("ANSI", "XTERM256", "TRUECOLOR"):
    self.protocol_flags[color] = True

I'd make a PR, but this is clearly a bandaid fix and there should be a better way to fix it to maintain the code quality.

Environment

    Evennia 3.1.1
    OS: posix
    Python: 3.10.9
    Twisted: 23.10.0
    Django: 4.2.9

I should note that I actually have Python 3.11.6 installed, but for whatever reason it's showing up as 3.10.9, and I have no idea why. My Python binary itself is named 3.11.

The issue here was just that the protocol-flags were accessed a line too early in the protocol.