omega-encoding: gate pwrite-from-text / pread-into-text at f4df8239 (refs #211)
opene0b283967536588d #212 · opened 2026-11-07 06:01 UTC
Imported from GitHub aien-dev/omega-harness#212, by drakestapleton
Base bd107ca15c40b6cdfef0f23afb03a884fe3c8086 · Head 3df8ff98cd64c863981eabaa1c06159df561fc7f
drakestapleton wrote on 2026-11-07 06:01 UTC
Refs #211. PENDING (draft); do not merge without review.
#211 reported pwrite from a text as error 20. That holds only for omc 2c824805… (omega-mv e5b32567); omega-mv #904 (e2662fff) moved the check to pread, and section 9 already said so in prose. #211 came from an omega MCP server that still reports compiler_sha256 2c824805 after the omega-mcp #6 repin, and from an installed ~/.claude/skills/omega-encoding copy dated 2026-10-26 that predates the #904 note.
This PR makes the current rule executable:
examples/pwrite_text.om: pwrite from a text, pread back into a global, exit 0, stdout pwrite\n.
examples/err20_pread_text.om: pread into a text, omc: line 6: error 20.
SKILL.md section 9 cites both examples, records the reversed e5b32567 results, and adds a compiler_sha256 check for MCP results. Section 0 and README.md record 112 examples.
Evidence (HOST_TESTED, Linux AArch64, spark-b87b core 18, 2026-11-07):
omc rebuilt from seed at f4df8239 (sh seed/omega-from-seed.sh, RC 0), sha256 3ad9f10f…3194 = PIN_SHA.
Negative control on a scratch copy (err20 expect set to compile 0, pwrite stdout set to pwrote): GATE FAIL examples=112 pass=110 fail=2, exit 1.
Gate pointed at 2c824805 omc: refused, exit 2. Run directly, that omc gives pwrite_text line 14: error 20 and err20_pread_text compile rc 0, which is the reversal.
Apply it
git checkout -b patch-e0b283967536588dbd107ca15c40b6cdfef0f23afb03a884fe3c8086
curl -fsSL https://interplane.io/drakestapleton/omega-harness/patches/e0b283967536588d.patch | git am
diff --git a/README.md b/README.md
index 7b97e88..2febea6 100644
--- a/README.md
+++ b/README.md
@@ -115,7 +115,7 @@ examples/gate.sh omega-src/seed/out/omc
```
It prints `PASS name` or `FAIL name: reason` per program and ends with
-`GATE PASS examples=110 pass=110 fail=0 omc=3ad9f10f...` (exit 0), `GATE FAIL ...` (exit 1), or a hash
+`GATE PASS examples=112 pass=112 fail=0 omc=3ad9f10f...` (exit 0), `GATE FAIL ...` (exit 1), or a hash
refusal (exit 2), for example `GATE FAIL omc sha256 b4f45121..., pinned 3ad9f10f... (omega-mv f4df8239...)`
for the previous pin's compiler. The `omega-encoding` skill (section 0 and section 13) records the observed results
and the negative controls; [`examples/WOLFRAM.md`](examples/WOLFRAM.md) records the Wolfram checks of
diff --git a/examples/err20_pread_text.expect b/examples/err20_pread_text.expect
new file mode 100644
index 0000000..db253e4
--- /dev/null
+++ b/examples/err20_pread_text.expect
@@ -0,0 +1,2 @@
+compile 20
+stderr omc: line 6: error 20
diff --git a/examples/err20_pread_text.om b/examples/err20_pread_text.om
new file mode 100644
index 0000000..56e45db
--- /dev/null
+++ b/examples/err20_pread_text.om
@@ -0,0 +1,8 @@
+note err20_pread_text: pread writes its array, so pread into a text is error 20, as for read.
+note pwrite from the same text compiles (pwrite_text.om). Up to omc 2c824805 (omega-mv e5b32567)
+note the two words were reversed: this compiled and pwrite from a text was error 20.
+text t "abc"
+fn main to int
+r = pread 0 t 0 3 0
+ret 0
+end
diff --git a/examples/pwrite_text.expect b/examples/pwrite_text.expect
new file mode 100644
index 0000000..420e65e
--- /dev/null
+++ b/examples/pwrite_text.expect
@@ -0,0 +1,2 @@
+compile 0
+exit 0
diff --git a/examples/pwrite_text.om b/examples/pwrite_text.om
new file mode 100644
index 0000000..d12b509
--- /dev/null
+++ b/examples/pwrite_text.om
@@ -0,0 +1,29 @@
+note pwrite_text: pwrite only reads its array, so a text is a valid source (omega-mv #904, e2662fff).
+note pread writes its array, so its destination must be writable: a global here (err20_pread_text.om
+note is the text case). Up to omc 2c824805 (omega-mv e5b32567) the check sat on the wrong word and
+note this program was error 20 at the pwrite line. Run in an empty scratch directory; Linux AArch64
+note O_RDWR|O_CREAT|O_EXCL = 194, mode 0600 = 384.
+text fname "f.bin"
+text body "pwrite\n"
+global rb uchar 16
+fn main to int
+fd = fopen fname 0 len fname 194 384
+if lt fd 0
+exit 90
+end
+w = pwrite int fd body 0 len body 0
+if ne w long len body
+exit 91
+end
+r = pread int fd rb 0 len body 0
+if ne r long len body
+exit 92
+end
+k = write 1 rb 0 ulong r
+c = fclose int fd
+u = unlink fname 0 len fname
+if ne u 0
+exit 93
+end
+ret 0
+end
diff --git a/examples/pwrite_text.stdout b/examples/pwrite_text.stdout
new file mode 100644
index 0000000..a999c44
--- /dev/null
+++ b/examples/pwrite_text.stdout
@@ -0,0 +1 @@
+pwrite
diff --git a/skills/omega-encoding/SKILL.md b/skills/omega-encoding/SKILL.md
index 94dd8fa..688c57d 100644
--- a/skills/omega-encoding/SKILL.md
+++ b/skills/omega-encoding/SKILL.md
@@ -370,7 +370,17 @@ binary printed
`GATE PASS examples=110 pass=110 fail=0 omc=3ad9f10f64309e7acf8a725082b28e23a2a4aeb07e98322fb4dc0fcd8fc93194`
(exit 0) on 2026-11-05, Linux AArch64. Negative control: the gate pointed at the previous omc
`b4f45121…9b55` was refused with exit 2 (`GATE FAIL omc sha256 b4f45121…, pinned 3ad9f10f…
-(omega-mv f4df8239…)`). The section below is the previous pin.
+(omega-mv f4df8239…)`).
+
+On 2026-11-07, Linux AArch64, adding `examples/pwrite_text` and `examples/err20_pread_text`
+(section 9, pread/pwrite) brought the gate to
+`GATE PASS examples=112 pass=112 fail=0 omc=3ad9f10f…3194`, exit 0. That omc was rebuilt from seed
+at `f4df8239` and its sha256 matched the pin. Negative controls, both run on a scratch copy:
+- With `err20_pread_text.expect` set to `compile 0` and `pwrite_text.stdout` set to `pwrote\n`, the
+ gate ended `GATE FAIL examples=112 pass=110 fail=2`, exit 1.
+- The gate pointed at `2c824805…` (omega-mv `e5b32567`) was refused with exit 2.
+
+The section below is the previous pin.
### Rerun at omega-mv `d3d1b1bc` (2026-11-04, previous pin)
@@ -1416,9 +1426,20 @@ AArch64 host with main `seed/out/omc` (`omc < file`): `seed/omc/om2/s4/v-bad-pre
`omc: line 5: error 20` (rc 20); `seed/omc/om2/s4/v-pwrite-text.om` compiles (rc 0) and runs with
exit 0, writing `ABC\n` to stdout. Host evidence only.
+Gated at the guide pin (omega-mv `f4df8239`, omc `3ad9f10f…3194`) by
+[`examples/pwrite_text.om`](../../examples/pwrite_text.om): `pwrite` from a `text` into a scratch file, then
+`pread` back into a `global`, exit 0 with `pwrite\n` on stdout. Its counterpart,
+[`examples/err20_pread_text.om`](../../examples/err20_pread_text.om), is `pread` into a `text` and gives
+`omc: line 6: error 20`.
+
Historical note: up to omc `2c824805…` (omega-mv `e5b32567`, the omega MCP pin before omega-mcp #6) the check sat on
the wrong word: `pwrite` from a `text` was error 20 and `pread` into a `text` compiled and returned
-`-EFAULT` at run time. Code written for that pin copied a text into a `new` array before `pwrite`.
+`-EFAULT` at run time. Code written for that pin copied a text into a `new` or `global` array before `pwrite`.
+Rerun 2026-11-07 with that omc on both new examples, which shows the reversal:
+- `pwrite_text.om` gives `omc: line 14: error 20` (the `pwrite` line).
+- `err20_pread_text.om` compiles with rc 0.
+
+An omega MCP server whose `compile` result still reports `compiler_sha256` `2c824805…` gives the old answer. One did on 2026-11-07, which is how this was found again ([#211](https://github.com/aien-dev/omega-harness/issues/211)). Check the hash before you trust an error 20 on `pwrite`.
**x86efi firmware boundary word `efi`, OP 11 boot-file word (in the pin: omega-mv `d3d1b1bc` / omc `b4f45121…`, merged via [omega-mv#1015](https://github.com/aien-dev/omega-mv/pull/1015); the previous pin `9920aab1` / omc `be8c5130…` refuses `target x86efi` with error 25).**
Read [omega-mv `docs/X86-EFI.md`](https://github.com/aien-dev/omega-mv/blob/main/docs/X86-EFI.md) for the full word. Under `target x86efi` it is `r = efi OP ARG A OFF N`: