alces-software / adminware

A sandbox CLI for running commands remotely across nodes
1 stars 0 forks source link

Entering """ or '''' crashes the sandbox #86

Open DavidMarchant opened 6 years ago

WilliamMcCumstie commented 6 years ago

This doesn't sound good. Could we get some more information about the issue? It sounds a bit more important than low priority.

DavidMarchant commented 6 years ago

Yes, absolutely:

adminware> '''
Traceback (most recent call last):
  File "src/adminware", line 7, in <module>
    adminware()
  File "/tmp/adminware/venv/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/tmp/adminware/venv/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/tmp/adminware/venv/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/tmp/adminware/venv/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/tmp/adminware/venv/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/tmp/adminware/src/appliance_cli/sandbox.py", line 27, in sandbox
    allow_internal_commands=False,
  File "/tmp/adminware/venv/src/click-repl/click_repl/__init__.py", line 190, in repl
    args = shlex.split(command)
  File "/usr/lib64/python3.5/shlex.py", line 273, in split
    return list(lex)
  File "/usr/lib64/python3.5/shlex.py", line 263, in __next__
    token = self.get_token()
  File "/usr/lib64/python3.5/shlex.py", line 90, in get_token
    raw = self.read_token()
  File "/usr/lib64/python3.5/shlex.py", line 166, in read_token
    raise ValueError("No closing quotation")
ValueError: No closing quotation

The reason I specified low priority is it's been a known issue with userware (https://github.com/alces-software/userware/issues/22) for quite some time. What do you want to do about it?

WilliamMcCumstie commented 6 years ago

Hmmm this looks like a click issue and quite possible is out of our control. The bug is occurring within library code before we get to the commands. Therefore we won't have an opportunity to parse the input before it errors.

The best we could possible do is catch the exception inside the adminware command. Then possible check argv if it is running in sandbox mode, and restart the appliance.

  File "src/adminware", line 7, in <module>
    adminware()