Make fdbcli gracefully handle malformed and partial command errors.
Previously, running a command like `set \xffx\02abcded/` would cause a crash. The `x\02` is a malformed typo of `\x02`, and the previously existing code to handle this case looks like loop { err = parse_command if (err) continue; // do things } Thus, if we hit an error, we'd go back to the top of the loop, and try again. This should be an infinite loop. However, the actor compiler implementation of loops involves function calls, so this actually turns into a series of the loop head calling the loop body calling the loop head calling ... and we eventually crash due to running out of stack. This is now fixed by simply letting the code continue on to the check later that does if (there was an error) { print nasty message return error } With output that looks like ERROR: malformed escape sequence WARNING: the previous command failed, the remaining commands will not be executed. And therefore the world becomes a happy place.
This commit is contained in:
parent
5ee07b1a9e
commit
d78b29625c
|
@ -2222,12 +2222,10 @@ ACTOR Future<int> cli(CLIOptions opt, LineNoise* plinenoise) {
|
|||
if (err) {
|
||||
LogCommand(line, randomID, "ERROR: malformed escape sequence");
|
||||
is_error = true;
|
||||
continue;
|
||||
}
|
||||
if (partial) {
|
||||
LogCommand(line, randomID, "ERROR: unterminated quote");
|
||||
is_error = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
state bool multi = parsed.size() > 1;
|
||||
|
|
Loading…
Reference in New Issue