Ctrl-D (EOF) causes seg fault
A BASIC interpreter and compiler with graphics.
Brought to you by:
kollo
The man page advises to use Ctrl-C, but throwing a seg fault and dumping core is just so untidy. Most interactive systems exit [relatively] cleanly on EOF and the little patch attached does that for X11-Basic.
Perhaps the man page should be updated as well.
Thanks for the feedback. A Segfault (with INPUT) should of course not happen. My question is: Should INPUT just return, or should the interpreter really quit?
I do not change the man page, because CTRL-C should be the code to make the interpreter quit (If a program is running, the first CTRL-C will stop the running program, and enter command input mode). If in command input mode, a CTRL-C as well as a CTRL-D will make the interpreter quit. Still open is the question, wherethere CTRL-D in an INPUT command should quit or just abord the INPUT (hence continuing with the rest of the program)
Markus, Duncan found this issue when I was testing the 'standalone' binary feature of X11-Basic preparing for a Slackware build.
Personally I think Ctrl+D/d should just be ignored and do nothing.
Nick
Hm, maybe there is a point when x11basic is invoked from a script and gets input like this
xbasic testme.bas <<EOF
some text here
EOF
Maybe it shoud really terminate on EOF... Hm...
I suggest x11basic has to stop on receiving EOF. Python does that, as does expect, tclsh and even bash (possibly on repeated EOF)
It has been solved in following way:CTRL-D now quits the interpreter in interactive mode, but on INPUT only the INPUT command is aborted and the rest of the program can continue.
Thank you for mentioning this issue. And also for your patch and comments.
Last edit: Markus Hoffmann 2019-07-09