Skip to content

fix: #292 | EOF and 0-byte infinite loop#322

Open
winex wants to merge 2 commits into
albertodemichelis:masterfrom
winex:master
Open

fix: #292 | EOF and 0-byte infinite loop#322
winex wants to merge 2 commits into
albertodemichelis:masterfrom
winex:master

Conversation

@winex

@winex winex commented Mar 22, 2026

Copy link
Copy Markdown

fix #292 | tldr; "infinite loop in interactive interpreter on EOF and 0-byte"
thanks @Keith-S-Thompson in #292 (comment) for pointing this out and providing a patch, but '\0' should also be checked and doing this last

my tests pass (insignificant lines removed):

  • Ctrl-D (^D) , EOF
  • '\n'
  • '\0'+
  • $ cat /dev/random | squirrel3...
$  ./squirrel3
sq> ^D
$  echo | ./squirrel3
sq>
sq>
$  echo -n | ./squirrel3
sq>
$  cat /dev/null | ./squirrel3
sq>
$  cat /dev/zero | ./squirrel3
sq>

note: echoing newline looks correct - 2 prompts

well, /dev/random doesn't seem to be correct input ;p , so i haven't checked that thoroughly:

$  cat /dev/random | ./squirrel3
sq>
interactive console line = (1) column = (0) : error unexpected character(control)
$  cat /dev/random | ./squirrel3
sq>
interactive console line = (1) column = (1) : error expression expected

at least it seem to stop.

let me know if anything more should be checked/tested. this loop still looks like bad to me...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sq : input line too long, interactive console line = (1) column = (1) : error expression expected

1 participant