~ chicken-core (master) aeec82d1840b311d225aa59df7785594463faa23
commit aeec82d1840b311d225aa59df7785594463faa23
Author: Peter Bex <peter@more-magic.net>
AuthorDate: Fri May 24 22:23:20 2019 +0200
Commit: Kooda <kooda@upyum.com>
CommitDate: Sat May 25 10:42:45 2019 +0200
Fix obscure bug triggered by marking keywords persistable
When a keyword has already been read at runtime, and then compiled
code is invoked which calls C_h_intern_kw, the keyword will already
exist. This is when it is marked as persistent because there's an
lf[] referring to it, so it can't be garbage collected.
The C_i_persist_symbol() call would then bail out because the offered
object is not a symbol but a keyword (the check was done with
C_i_check_symbol).
This caused several eggs depending on "foreigners" to break, because
it exports a macro in the import library which happens to use a
keyword.
Signed-off-by: Kooda <kooda@upyum.com>
diff --git a/runtime.c b/runtime.c
index 8a51fd82..30620a22 100644
--- a/runtime.c
+++ b/runtime.c
@@ -2442,7 +2442,13 @@ C_regparm C_word C_fcall C_i_persist_symbol(C_word sym)
C_word bucket;
C_SYMBOL_TABLE *stp;
- C_i_check_symbol(sym);
+ /* Normally, this will get called with a symbol, but in
+ * C_h_intern_kw we may call it with keywords too.
+ */
+ if(!C_truep(C_i_symbolp(sym)) && !C_truep(C_i_keywordp(sym))) {
+ error_location = C_SCHEME_FALSE;
+ barf(C_BAD_ARGUMENT_TYPE_NO_SYMBOL_ERROR, NULL, sym);
+ }
for(stp = symbol_table_list; stp != NULL; stp = stp->next) {
bucket = lookup_bucket(sym, stp);
Trap