Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

README.md

2.93 Kb · 65 lines

gno.land/p/moul/x/plan9/rc/v0

A small shell over a Plan 9 namespace: ls, cat, stat, ns, bind, mount, unmount, mkdir, rm, echo, cd, pwd, walk, help.

1import rc "gno.land/p/moul/x/plan9/rc/v0"
2
3sh, fs := rc.NewMemShell("g1...", rc.ReadWrite, runtime.ChainHeight)
4out, err := sh.Run("bind -ac /srv/dev /dev; echo hello > /tmp/greeting; ls -l /")

A namespace you cannot inspect is a namespace you cannot trust. Everything here operates on an ns.Ns and returns text, so one realm's Render becomes a file browser and one transaction becomes a shell command.

The mode split is the security model. A shell in ReadOnly mode refuses every mutating command, which is what lets a realm expose it through Render, where mutating anything would be a bug, while the same code backs a crossing Exec that may write.

On the first error the run stops and returns it. A realm should let that error panic, so a half-applied command line reverts with its transaction rather than leaving a namespace nobody asked for.

Two commands exist to make a namespace legible rather than to do work:

  • ns prints the mount table in ns(1) format.
  • walk /bin/rc prints how each element resolves, with the union width per step. It is where a bind stops being magic: the width column says exactly where one took effect, and that a union is top level only.

Quoting follows rc: single quotes, with '' inside a quoted string standing for one literal quote. Commands are separated by ; or newlines, and quoting is respected when splitting them. MaxCommands (32) bounds one run.

Live demo: r/moul/x/plan9/ns renders it. Design and analysis: moul/gno-contracts#136.


Not affiliated with Plan 9. Plan 9 from Bell Labs is the work of the Computing Science Research Center at Bell Labs; the name and the marks are theirs, and the copyright is held by the Plan 9 Foundation. This package borrows the vocabulary and none of the code: it is an independent homage, asking what that ecosystem's spirit looks like on a chain. Full attribution: NOTICE.


Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

Dependency graph:

gno.land/p/moul/x/plan9/rc/v0 dependency graph

🧪 Highly experimental — potentially vibe-coded. Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: DISCLAIMER.