interplane.Get Omega
Read in your language

omega-bridge

Omega-first language interoperability: checked conversion backends and native language bindings

Brought by drakestapleton

branch main Branches Tags History

omega-bridge / evidence / device-window / DRA-441 / execenv-proposal.md

46 lines · 2475 bytes Raw Blame History Rendered
1# Proposal: an `execenv` whose environment packet is sized from its input
2
3Status: PROPOSED (omega-mv compiler extension). Not implemented.
4
5## Why
6
7`tools/run-device-window.om` must start `spark-window`, `git` and the probe
8programs with the caller's environment and a `PATH` search. omega-mv
9`execenv A off n B off m` (docs/one_layer/OMEGESE.md, keyword id 233) takes the
10environment as packet B with a count of 1..64 records and at most 4096 bytes.
11The environment on spark-b87b had 78 entries and 4796 bytes on 2026-11-16, so
12the driver cannot use `execenv` and runs every child as
13`/usr/bin/env -i -- <NAME=VALUE ...> CMD ...` through `execprog`.
14
15That makes `/usr/bin/env` a host dependency of the build-free run path:
16GNU coreutils 9.4 on spark-b87b, sha256
17`d38fa7db8452a564868961fd5e9a0aa787095676b0fd6e497b766ac40ec65c8b`. It does two
18things for us: it sets the child's environment from its arguments and it finds
19`CMD` on `PATH`.
20
21The 64-record and 4096-byte limits are fixed sizes, not machine boundaries: the
22kernel's own boundary is the argument-plus-environment space (a quarter of the
23stack limit, never below 32 pages) and 131072 bytes per string
24(`MAX_ARG_STRLEN`). The execprog packet has the same shape of limit (65536
25bytes, 1024 records, u16 record lengths).
26
27## Change
28
291. `execenv`: size the environment packet from its input. Keep the packet
30 form (u16 count, u16-length records) but accept any count and total that fit
31 the packet's own fields, check each record (non-empty, no zero byte, one `=`
32 after a non-empty name), and refuse with the documented negative errno
33 `-E2BIG` only when the kernel does.
342. `execprog`/`execenv`: add a PATH search form (`execpath`), following POSIX
35 `execvp` (search the `PATH` of packet B, skip entries that fail with
36 `ENOENT`/`ENOTDIR`/`EACCES`, return the last other error).
373. Records longer than 65535 bytes need a wider length field: a second packet
38 version with u32 lengths, so that an environment entry up to
39 `MAX_ARG_STRLEN` passes (the driver refuses such an entry today, exit 3).
404. Gate: `seed/host/execenv/` cases for 65, 200 and 2000 records, a 64 KiB
41 total, a 131071-byte record, an empty name, a missing `=`, a PATH search hit,
42 miss and `EACCES`, plus an alarm test that reports the largest environment
43 seen in the gate run (no cap; the no-hard-caps rule).
44
45When this lands, `tools/run-device-window.om` drops `/usr/bin/env` and builds
46packet B from `envread` directly.