I was using fatback in interactive mode, and tried to
change into a directory which had a space in its (long)
name. Unfortunately, I forgot to put the closing quote
and just entered
fatback>cd "Black Isle
On hitting Return, fatback started printing
Error: unfinished quote
to the console, and did so endlessly until I killed the
process.
The cause is in interface.c, in the split_line and
cmdline_car functions. split_line has a loop counter
over the input line of text, but doesn't actually
increment it; instead it passes a reference to it as a
parameter to cmdline_car, and expects that to update
it. Under normal circumstances, cmdline_car will find
the limits of the next word, allocate memory for it and
make a copy, update the counter (*index = i;) and
return a reference to the copy. If there are
mismatched quotes or the length of the word is zero
(e.g. ""), then it just returns NULL. However, in
these circumstances it fails to update the loop
counter... so split_line immediately calls it again
with the exact same starting position, leading to an
infinite loop!
The simplest fix is to simply add
*index = i;
lines immediately before both of the
return NULL;
statements.