v4 init.4th, steps 1 and 2: the ACL policy loaded after POST, then the search order
Captain Bob ruled "ACL at boot", loaded "From init.4th", the include "Compose[d] in FORTH". - capsules/v4/init.4th, at block 3980: S" v4:ACL.4th" CAPSULE-INCLUDE, then STARSHIPOS. - capsules/v4/ACL.4th is the policy, git mv'ed from v4/capsule/ACL.fth and reflowed into chained 64x16 blocks, its text unchanged. - CAPSULE-INCLUDE in centre.4th places a capsule and LOADs its lowest block. It is composed from CAPSULE-OPEN and CAPSULE-LINE, with no new C word. - The mesh loads v4:init.4th after POST and COLD, its one fixed step there. Test first in test_mesh_boot: the parity line, DOE without naming STARSHIPOS, and ACL-BOOT pinned. The before-run failed. After: 113 checks pass and POST is 990/990. All 52 tests, test-32 and ASan/UBSan pass. The dictionary has 405 words. One amd64 session passes 18/18 with "ACL: active". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
@@ -482,6 +482,9 @@ static int load_source(const char *name)
|
||||
while (fgets(line, sizeof line, f)) {
|
||||
size_t len = strlen(line);
|
||||
num++;
|
||||
/* a capsule's blocks, typed at the prompt in order: its headers are not FORTH, and `-->`, which chains
|
||||
* to the next block when the kernel LOADs it, is an error at the terminal */
|
||||
if (strncmp(line, "Block ", 6) == 0 || strcmp(line, "-->\n") == 0) continue;
|
||||
if (len == 0 || line[len - 1] != '\n' || len > 80) { printf(" %s line %u: too long\n", name, num); fclose(f); return 0; }
|
||||
(void)say(line);
|
||||
/* every line is accepted: whatever it printed, it ended with " ok" and never with ERROR */
|
||||
@@ -1632,9 +1635,9 @@ int main(void)
|
||||
CHECK(is(say("SEE NOSUCH\n"), "SEE: not found\n ok\nok> ") && is(say("SEE\n"), "SEE: not found\n ok\nok> "), "a word that is not there");
|
||||
CHECK(is(say("(.\")\n"), "(.\"): compile-only\n ERROR\nok> ") && is(say("(S\")\n"), "(S\"): compile-only\n ERROR\nok> "), "the string run-time words have names but cannot be run from the prompt");
|
||||
|
||||
/* ---- access control with its policy loaded: ACL.fth, FORTH source ---- */
|
||||
/* ---- access control with its policy loaded: capsules/v4/ACL.4th, FORTH source ---- */
|
||||
boot_bare();
|
||||
CHECK(load_source("ACL.fth"), "ACL.fth compiles, every line of it");
|
||||
CHECK(load_source("../../capsules/v4/ACL.4th"), "ACL.4th compiles, every line of it");
|
||||
CHECK(strstr(out, "\033[32mINFO: \033[0mACL: active\n") == out && n.mem[ACL_HOOK] != 0, "and its last line switches access control on");
|
||||
CHECK(is(say(": FOO 65 EMIT ; FOO ' FOO ACL-TTL@ . FOO ' FOO ACL-TTL@ .\n"), "A256 A255 ok\nok> "), "a word's first use is rechecked and earns it a TTL, which is then counted down");
|
||||
CHECK(is(say(": SFOO 66 EMIT ; ' SFOO ACL-STRICT SFOO SFOO ' SFOO ACL-TTL@ .\n"), "BB0 ok\nok> ") && is(say("' SFOO ACL-MODE@ .\n"), "1 ok\nok> "),
|
||||
|
||||
Reference in New Issue
Block a user