diff options
Diffstat (limited to 'web/content')
| -rw-r--r-- | web/content/_index.md | 74 | ||||
| -rw-r--r-- | web/content/docs/_index.md | 7 | ||||
| -rw-r--r-- | web/content/docs/develop.md | 46 | ||||
| -rw-r--r-- | web/content/docs/install.md | 62 | ||||
| -rw-r--r-- | web/content/docs/status.md | 40 |
5 files changed, 229 insertions, 0 deletions
diff --git a/web/content/_index.md b/web/content/_index.md new file mode 100644 index 0000000..341db58 --- /dev/null +++ b/web/content/_index.md @@ -0,0 +1,74 @@ +--- +title: zash +description: A small, fast POSIX shell for z/OS UNIX System Services, in the Almquist (ash) tradition. +--- + +## Why another shell + +The z/OS `/bin/sh` is dated, and the usual alternatives are bash and zsh. +Those are comfortable interactively but slow as scripting shells, large, and +encourage scripts that run nowhere else. On z/OS that cost is real: CPU time is +billed, and every `fork()` copies an address space. + +<div class="feature-grid"> + <div class="card"> + <span class="tag">cheap processes</span> + <h3>spawn(), not fork()</h3> + <p>Children come from <code>spawn()</code>, so <code>_BPX_SHAREAS</code> + can keep them in the same address space. Builtins cost no process at all, + even in a pipeline or a command substitution.</p> + </div> + <div class="card"> + <span class="tag">plain POSIX</span> + <h3>sh scripts, not a dialect</h3> + <p>Scripts written for zash run under the existing <code>/bin/sh</code>, + dash, FreeBSD sh and bash. The Korn features z/OS scripts use are there + where they cost other scripts nothing.</p> + </div> + <div class="card"> + <span class="tag">built for z/OS</span> + <h3>ASCII or EBCDIC</h3> + <p>The character set is a compile-time choice and the source assumes + neither. File tagging, <code>STEPLIB</code> and the z/OS shell behaviours + scripts rely on are in scope.</p> + </div> + <div class="card"> + <span class="tag">pleasant</span> + <h3>An interactive shell too</h3> + <p>Job control, tab completion, history, emacs and vi editing, with + bash's key bindings. None of it is initialised by a non-interactive + shell.</p> + </div> +</div> + +## How it compares + +CPU-seconds on Linux x86-64 from `make bench`, user+sys with children +included. The benchmark scripts check each shell's answers as well as timing +it. + +| benchmark | zash | dash | bash | ksh93 | oksh | +| --- | --- | --- | --- | --- | --- | +| `$(builtin)` x 40000 | 0.01 | 8.20 | 17.99 | 0.11 | 25.24 | +| small pipelines and `$(a \| b)` | 1.10 | 2.35 | 3.16 | 1.33 | 2.32 | +| render and check 100 configs | 0.38 | 0.46 | 0.53 | 0.26 | 0.52 | +| 2000 external commands | 0.55 | 0.53 | 0.81 | 0.56 | 0.84 | + +On z/OS the gap against IBM's `/bin/sh` is far wider, because a `fork()` there +copies an address space. The full tables for both platforms are in the +[project README](https://github.com/skurtz97/zash#status). + +## Get started + +```sh +git clone https://github.com/skurtz97/zash +cd zash +make # Linux: ./zash +make check # run the suite +``` + +On z/OS, `make` builds the ASCII `./zash` with IBM Open XL C/C++ and +`make zos-ebcdic` builds the EBCDIC variant. See +[Building zash]({{< relref "docs/install" >}}) for the z/OS targets and the +address-mode notes, and [Development]({{< relref "docs/develop" >}}) for what +the test suite covers. diff --git a/web/content/docs/_index.md b/web/content/docs/_index.md new file mode 100644 index 0000000..8893fad --- /dev/null +++ b/web/content/docs/_index.md @@ -0,0 +1,7 @@ +--- +title: Docs +--- + +Everything about building, testing and the current state of zash. The +authoritative documents are in the source tree: `README.md`, `DESIGN.md` and +`formal/zash-spec.pdf`. diff --git a/web/content/docs/develop.md b/web/content/docs/develop.md new file mode 100644 index 0000000..392987e --- /dev/null +++ b/web/content/docs/develop.md @@ -0,0 +1,46 @@ +--- +weight: 20 +title: Development +description: How zash is tested, benchmarked and kept warning-free. +--- + + +zash is one C23 source directory with a flat `.POSIX` makefile, and the tests +are shell scripts compared against expected output. + +## The suite + +```sh +make check # behavioural tests against ./zash +make asan # ASan + UBSan build, whole suite +make valgrind # whole suite under Valgrind, leaks included +make bench # CPU time against dash, bash, ksh, zsh, oksh +make format tidy # clang-format, clang-tidy +``` + +The tests are at several levels: + +- Behavioural tests for every feature. Portable ones also run under dash, and + the outputs are compared, so a disagreement with an existing ash-family + shell is always visible - either a bug or a deliberate difference. +- Sanitizer and Valgrind runs of the whole suite on Linux. +- Process accounting tests that assert the exact process count of a construct, + so `$(echo x)` creating a process fails the suite instead of quietly costing + a `fork()`. +- Security tests for what a shell must never do: create a file more permissive + than the umask allows, find a command in the current directory, or run what + an expansion or a file name produced. +- Interactive tests that drive the shell through a pseudo-terminal: editor keys + in emacs and vi modes, completion, history, prompts, job control. They need + python3 and are skipped without it. + +On z/OS the same behavioural and process-accounting tests run in either +character mode, plus a z/OS-only group. There is no ASan or Valgrind there; +Language Environment's heap checker does that job instead. + +## Benchmarks as tests + +`bench/run.sh` compares each shell's output with the reference shell's, so a +wrong answer fails the run instead of being timed and forgotten. `bench/ +report.sh` and `bench/deploy.sh` are the two scripts that look most like what +the shell is for. diff --git a/web/content/docs/install.md b/web/content/docs/install.md new file mode 100644 index 0000000..3b6d670 --- /dev/null +++ b/web/content/docs/install.md @@ -0,0 +1,62 @@ +--- +weight: 10 +title: Building zash +description: How to build zash on Linux and on z/OS, and what it links against. +--- + + +Two toolchains, one source tree: Clang on Linux, IBM Open XL C/C++ on z/OS. +The code is plain C23 and does not use library additions newer than the C +libraries on either platform. + +| Platform | Compiler | Standard | +| --- | --- | --- | +| Linux | Clang | `-std=c23` | +| z/OS | IBM Open XL C/C++ (`ibm-clang`) | `-std=c23` | + +## Linux + +```sh +git clone https://github.com/skurtz97/zash +cd zash +make # -> ./zash +make check # run the test suite against it +make install # copy it into $(DESTDIR)$(BINDIR) +``` + +`EDIT=libedit LDLIBS=-ledit` builds against libedit instead of the built-in +line editor. The default editor is compiled in and initialised only for an +interactive shell. + +## z/OS + +```sh +make # the ASCII build, ./zash +make zos-ebcdic # the EBCDIC (IBM-1047) build, ./zash-ebcdic +make zos-check # the functional tests, then the EBCDIC ones +``` + +Both builds are 64-bit XPLINK. There is a zopen `buildenv` in the tree, so +`zopen build -gp` builds both test passes and installs into +`$ZOPEN_INSTALL_DIR`. + +`make zos-heapcheck` runs the suite with Language Environment check zones +after every heap element, `make zos-debug` and `make zos-dbx` open a debug +build under `dbx`, and `make zos-amblist` maps the CSECTs of the program +object. + +## Choosing an address mode + +Both builds are 64-bit. A 64-bit `fork()` used to cost 4.2 ms against 0.10 ms +for 31-bit, and a trivial program started in 29.5 ms against 1.1 ms, because +the 64-bit C run-time was loaded out of the linklist on every start. With that +run-time in the LPA the two widths cost the same, so the shell takes the wider +one. `bench/README.md` in the source tree has the measurements. + +## Documentation targets + +`make doc` builds the source reference with Doxygen into `docs/html`, and a +PDF when `pdflatex` is present. `make docs` adds HTML and PDF of `README.md` +and `DESIGN.md`, `make spec` typesets `formal/zash-spec.pdf` with typst, and +`make other-docs` runs the last two together. On z/OS those tools are usually +missing; the targets say so rather than failing silently. diff --git a/web/content/docs/status.md b/web/content/docs/status.md new file mode 100644 index 0000000..2c3b247 --- /dev/null +++ b/web/content/docs/status.md @@ -0,0 +1,40 @@ +--- +weight: 30 +title: Status +description: What works on Linux and on z/OS today, and what is still from documentation. +--- + + +## Linux + +Feature-complete for a first release: the scripting core, the FreeBSD and Korn +extensions, job control, and the interactive layer (built-in editor with emacs +and vi modes, completion, history, `fc`, libedit optional). It builds +warning-free with Clang as C23 and passes its suite plain, under ASan/UBSan and +under Valgrind. + +## z/OS + +Builds in both character modes with Open XL, 64-bit, passes its suite including +the `zos/` group, and debugs with `dbx`. The Language Environment heap-checker +run is the one exception: two signal tests fail there and pass in `zos-check`. + +Data set redirection and `tso` are the parts still written from documentation. + +## Language level + +Plain C23, and the project draws the line at the language itself: no +`<stdbit.h>`, `<stdckdint.h>` or other library additions newer than the +platforms' C libraries. A system whose libc is older still builds it. + +## Not planned + +- bash or ksh93 extensions: arrays, process substitution, `${var//a/b}`, brace + expansion, coprocesses. +- The legacy z/OS XL C/C++ compiler (`xlc`). +- Portability to every UNIX. Linux is supported and most development and all + sanitizer testing happens there; other POSIX systems will probably work but + are not a target. + +The roadmap and the reasoning behind each decision are in `DESIGN.md` in the +source tree. |
