pushfoo / pyc2e

A pure python interface for managing c2e instances and injecting CAOS
BSD 2-Clause "Simplified" License
2 stars 1 forks source link

Fix the linux interface #2

Closed pushfoo closed 4 years ago

pushfoo commented 4 years ago

Use @Namiraja 's documentation on lc2e setup for current linux versions. Then complete a basic version of the lc2e interface. Single port, no port climbing yet.

pushfoo commented 4 years ago

Unblocked by https://github.com/Nazushvel/dstation-2020 , going to try to get it fixed now.

pushfoo commented 4 years ago

The issues that were mentioned in the comments of the linux interface may be real after all:

        """
        Uses file injection as a work-around for a possible issue with the
        btetwork interface. Needs to be investigated more thoroughly.
        :param request_body:
        :return:
        """

b"\nrscr" appears to be used as a stand-in for end-of-file in the lc2e interface:

 $ nc localhost `cat ~/.creaturesengine/port`
outv totl 0 0 0
outs "\n"
rscr
305

However, rscr is also the declaration of the start of a removal script in c2e CAOS. If a script contains comments prior to the removal script and they were injected in between the \n and the rscr, lc2e might ignore the rscr as a marker of end of transmission. The next step is to verify that lc2e interprets the first \nrscr as end of transmission rather than \nrscr + EOF. If that is the case, then a file-based injection workaround might be needed.

pushfoo commented 4 years ago

Conversation with ligfx suggested that it should be the user's responsibility to strip out rscr and endm and the like in inject and removal scripts, and treat the insides of the scripts as just raw caos requests because they are likely not stored in the scriptorium . I'm skeptical that it should entirely be on the user as this library is supposed to be easy to use, but i also don't want to add the weight of an entire parsing library to validate user input.

It's also worth investigating the following possibilities:

pushfoo commented 4 years ago

Linux seems to expect \nendm at the end of script injection requests, whereas the windows interface explicitly forbids it according to chris double's doc.