joshiemoore/snakeware

snaketerm help() freezes snakewm

Opened this issue · 3 comments

I'm running snakeware0-0-3.img on Debian buster (stable) using QEMU version 3.1.0. I started up snakewm using

from snakewm.wm import SnakeWM
SnakeWM().run()

and ran snaketerm from the menu. When I entered help() into the input box and pressed Enter, the system seemed to freeze: nothing showed up in the console output, keyboard or mouse inptu had no effect, and pressing Alt+Esc did not exit snakewm. I have to reset the machine in QEMU to get it to restart. I've repeated these steps to make sure this is a reproducible bug.

Hmmm, I also noticed this behavior a few days ago with a different built-in function. This will definitely be an important thing to check out

This seems to be an issue with sys.stdin not being wrapped. sys.stdout is replaced with a StringIO object in snakewm/apps/tools/snaketerm:137, but sys.stdin is left unchanged.

Note that it is still possible to access the original streams as sys.__stdin__ and sys.__stdout__. Also, exec is generally unsafe and hard to make secure.

@joshiemoore What are your thoughts on replacing exec with a subprocess instance of python3? Are there any advantages to the current execution environment, e.g. access to globals for debugging purposes?