As rightly pointed out by florz and others, the "b" (break on repl) offers a potential security vulnerability by allowing code from stdin to be interpreted. This patch simply removes the option, as it doesn't seem to be widely used, anyway.
felix
From 2b34dfb2708b04bfdce0831afd2ec4c4d1eca0ff Mon Sep 17 00:00:00 2001 From: felix <fe...@call-with-current-continuation.org> Date: Sun, 12 Mar 2023 18:02:47 +0100 Subject: [PATCH] drop "b" runtime option --- chicken.h | 1 - csi.scm | 2 -- library.scm | 7 ------- manual/Using the compiler | 2 -- runtime.c | 6 ------ 5 files changed, 18 deletions(-) diff --git a/chicken.h b/chicken.h index 9d15ab74..928066ed 100644 --- a/chicken.h +++ b/chicken.h @@ -1696,7 +1696,6 @@ C_varextern C_TLS jmp_buf C_restart; C_varextern C_TLS void *C_restart_address; C_varextern C_TLS int C_entry_point_status; C_varextern C_TLS int C_gui_mode; -C_varextern C_TLS int C_enable_repl; C_varextern C_TLS void *C_restart_trampoline; C_varextern C_TLS void (*C_pre_gc_hook)(int mode); diff --git a/csi.scm b/csi.scm index 765d8c40..ea618521 100644 --- a/csi.scm +++ b/csi.scm @@ -260,8 +260,6 @@ EOF (or (##core#inline "C_i_tty_forcedp") (##sys#tty-port? ##sys#standard-input))) -(set! ##sys#break-on-error #f) - (set! ##sys#read-prompt-hook (let ([old ##sys#read-prompt-hook]) (lambda () diff --git a/library.scm b/library.scm index 9fc663e0..827666d5 100644 --- a/library.scm +++ b/library.scm @@ -5135,8 +5135,6 @@ EOF (define (signal x) (##sys#current-exception-handler x) ) -(define ##sys#break-on-error (foreign-value "C_enable_repl" bool)) - (define ##sys#error-handler (make-parameter (let ([string-append string-append]) @@ -5161,11 +5159,6 @@ EOF args)]))) (##sys#print #\newline #f ##sys#standard-error) (print-call-chain ##sys#standard-error) - (when (and ##sys#break-on-error (##sys#symbol-has-toplevel-binding? 'chicken.repl#repl)) - ;; Hack to avoid hard / cyclic dependency - ((##sys#slot 'chicken.repl#repl 0)) - (##sys#print #\newline #f ##sys#standard-error) - (##core#inline "C_exit_runtime" _ex_software)) (##core#inline "C_halt" #f)) (else (let ((out (open-output-string))) diff --git a/manual/Using the compiler b/manual/Using the compiler index 51cd9ffc..30e5ed2a 100644 --- a/manual/Using the compiler +++ b/manual/Using the compiler @@ -231,8 +231,6 @@ by the startup code and will not be contained in the result of ; {{-:ANUMBER}} : Specifies fixed ''temporary stack'' size. This is used mostly for {{apply}}. If you supply a zero size (the default), the temporary stack will be dynamically reallocated as needed. -; {{-:b}} : Enter a read-eval-print-loop when an error is encountered. - ; {{-:B}} : Sounds a bell (by writing ASCII 7 to stdout) on every major garbage collection. ; {{-:c}} : Forces console mode. Currently this is only used in the interpreter ({{csi}}) to force output of the {{#;N>}} prompt even if stdin is not a terminal (for example if running in an {{emacs}} buffer under Windows). diff --git a/runtime.c b/runtime.c index 76f0e12c..aa64092b 100644 --- a/runtime.c +++ b/runtime.c @@ -337,7 +337,6 @@ C_TLS C_word (*C_debugger_hook)(C_DEBUG_INFO *cell, C_word c, C_word *av, C_char C_TLS int C_gui_mode = 0, C_abort_on_thread_exceptions, - C_enable_repl, C_interrupts_enabled, C_disable_overflow_check, C_heap_size_is_fixed, @@ -1376,7 +1375,6 @@ void CHICKEN_parse_command_line(int argc, char *argv[], C_word *heap, C_word *st " -:tSIZE set symbol-table size\n" " -:fSIZE set maximal number of pending finalizers\n" " -:x deliver uncaught exceptions of other threads to primordial one\n" - " -:b enter REPL on error\n" " -:B sound bell on major GC\n" " -:G force GUI mode\n" " -:aSIZE set trace-buffer/call-chain size\n" @@ -1494,10 +1492,6 @@ void CHICKEN_parse_command_line(int argc, char *argv[], C_word *heap, C_word *st C_abort_on_thread_exceptions = 1; break; - case 'b': - C_enable_repl = 1; - break; - default: panic(C_text("illegal runtime option")); } } -- 2.33.0