summaryrefslogtreecommitdiffhomepage
path: root/DESIGN.md
Commit message (Collapse)AuthorAgeFilesLines
* docs(design): list base#number with the extensionsSean Kurtz47 hours1-0/+1
| | | | | | parse_based() now reads bases up to 64 with the bash/ksh93 digit set, and refuses a base out of range or a number that overflows, so the extension table and the specification (R-ARI-8) say the same thing.
* docs: zash is the successor to IBM's ksh88 /bin/shSean Kurtz2 days1-11/+27
| | | | | | | | | The shell it replaces is not a different language: it is of the KornShell line, and a script written for it runs under zash. Say that where the documents used to imply the opposite -- "the dash of z/OS", "the z/OS /bin/sh's semantics are not emulated" -- and sort what is left into places where IBM departs from POSIX (zash follows POSIX) and the few ksh88 features zash declines.
* docs: the tagging rule as the code does it, and input errors in the specfix/zos-tagging-and-csiSean Kurtz2 days1-5/+17
| | | | | | | | | | | | | | | | DESIGN.md's "File tags" table said an ASCII build defers the tag on a `>` target and takes the first writer's CCSID; sys_zos.c tags a file the shell creates as IBM-1047 text and converts its own writes, and the paragraph "the tag follows the writer" now says that deferred tags are the _TAG_REDIR_* cases only. The shell's own stdout and stderr are in the table now, and the reason the inherited conversion is harmless to a binary writer (gzip turns it off, and tests/zos/tagging.sh checks the archive) is written down. The specification records what a script reviewer needs: R-LEX-17 no longer just ends the body at end of input, it says zash does not warn where bash does, and the new zash-only error rule gives 127/126 for a script that cannot be opened and 2 for a read error while input is being read. The PDF is regenerated.
* design: state the zopen 819 rule, not a retagging recipeSean Kurtz2 days1-8/+10
| | | | | | | | The paragraph said to tag UTF-8 files ISO8859-1 and advised chtag -tc UTF-8, which is neither what the repository does nor what zopen wants: it codes to CCSID 819, has git check text out tagged ISO8859-1, and lists the files whose text Latin-1 cannot hold as UTF-8 exceptions in .gitattributes. It also put a euro sign in a file declared ISO8859-1.
* design: say who converts character sets, and who does notSean Kurtz2 days1-0/+17
| | | | | | | | | | | zash copies bytes; on z/OS the runtime converts between a tagged file and the program, and the ASCII build turns that on for itself. The line editor is the one place that looks at encoding: it keeps UTF-8 continuation bytes with their character, and does not measure double-width text. This is the paragraph missing from the questions about `cat` printing mojibake from a checkout whose files are tagged ISO8859-1.
* web: a design pass, and documents that stand on their ownSean Kurtz2 days1-1/+1
| | | | | | | | | | | | | | | | | The home page drops the feature-card grid for a numbered spec sheet and a full-width measured transcript. The docs pages get three columns on a wide screen - sections, text, and the page's own headings - with a rule that runs the height of the text, and a row of section chips on a phone. The hero carries the logo's periwinkle as a gradient and the grid of a terminal screen, and the header a single lit hairline. The generated README, Design and Specification pages no longer carry the logo block, the byline, their own contents list or a second title: the site header, the sidebar and the front matter do that. Links between the documents are page links, and the GitHub-only affordances (sidebar blob links, "Edit this page") are gone. The xlc compiler is no longer called legacy in README, DESIGN or status.
* interactive: one editor, no libraryeditor/one-editorSean Kurtz4 days1-25/+18
| | | | | | | | | | | | | | | | | | | | | | | | libedit was a compile-time alternative (`make EDIT=libedit`). It goes: FreeBSD and NetBSD `sh` use it because it is in their base system, which is not the case on z/OS, and it cost about a third of a millisecond to reach the prompt -- three more shared libraries, `el_init()`, an `~/.editrc` read and a copy of the history -- for the same cost per key. What it bought was `~/.editrc` bindings and a kill ring; `bind` and the built-in editor's own bindings cover the keys, and a second editor meant a second build mode and a second set of interactive expectations, with seven tests skipping under it. Everything that existed only to serve two editors goes with it: the `EDIT` switch and the two `edit_$(EDIT)` paths in the makefile, the `$ZASH_EDITOR` variable the tests used to skip, the skip guards in `tests/linux/`, the NUL stripping in `ptydrive.py` that libedit's redraw needed, and the parallel paragraphs in README.md, DESIGN.md, bench/README.md and the two website pages. `bench/README.md` keeps the measurement, since that is why the decision is written in DESIGN.md. Checked on Linux (97 passed, 1 skipped, the one known local failure in linux/i-dscomplete) and on z/OS (64 passed, 3 skipped, 0 failed, plus the EBCDIC build).
* interactive: completion works in the libedit build tooSean Kurtz4 days1-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The libedit editor had no Tab binding at all, so the same line typed in the two builds behaved differently: `myalias<Tab>` completed under the built-in editor and ran the name as written under libedit. Completion is not an editor feature here — it is the shell's, from complete.c — so the boundary moves: complete.c now owns the escaping (`complete_escaped()`) and the candidate listing (`complete_listing()`), and each editor only inserts the result into its line. For libedit that means a function bound to ^I: it deletes the word, inserts the escaped candidate, finishes a unique one with a space and asks for a full redraw (a tail-only refresh left the terminal showing a line the shell did not have). Two things cost time to find: the binding name is the editrc spelling `^I`, not a literal Tab, and EL_EDITOR has to be set before EL_ADDFN/EL_BIND, because selecting an editor replaces the key map and drops what was bound before. $ZASH_EDITOR says which editor is compiled in. Keys, redraw and listings are the editor's own — libedit reads ~/.editrc, and its redraw of a prompt that starts with an OSC title leaves one space too many on the screen — so the interactive tests that encode the built-in editor's bindings and drawing skip under libedit, with a reason. i-complete, which covers the completion both now share, passes under both. tests/tools/ptydrive.py drops NUL bytes from what it compares: libedit writes a run of them after "erase to end of line" when it redraws, and a NUL puts nothing on a screen. Built-in build: 97 passed, 1 skipped, 1 failed (linux/i-dscomplete, the known local failure). libedit build: 6 passed, 7 skipped, 0 failed.
* bench: make the start-up number a minimum of interleaved roundsbench/startup-roundsSean Kurtz4 days1-0/+7
| | | | | | | | | | | | | | | | | | | | | | startup.sh ran BENCH_N starts once, and on the shared z/OS machine the same binary measured anywhere between 5 and 14 ms depending on the hour. Now each cell is the fastest of BENCH_R rounds (default 5) of BENCH_N starts, and a row's two columns are measured one after the other inside each round, so `-c :` and `script` see the same load instead of one following five rounds of the other. A minimum is the right summary because contention only adds time. Measured that way on cbt today, zash is 1.34 ms for `-c :` and 1.36 ms for a script, and the z/OS sh 2.16 and 2.18 — the same two numbers bench/README.md already claimed from a quieter machine, which is the point: the method now reproduces them. Also records the rule the ksh88 constraint implies: where zash and the z/OS sh disagree, zash keeps the better behaviour unless a ksh88 script could observe it, and the one such case — a failed redirection, assignment or read being 2 rather than 1 — is accepted because POSIX does not pin it and the shells disagree among themselves.
* bench: read the 28 differences from the host's shbench/compat-triageSean Kurtz4 days1-0/+6
| | | | | | | | | | | | | | Every script that zash and the IBM sh disagree on has now been read. None is a zash bug: zash matches dash on all 38 (that is what the suite says), and the differences are the IBM shell's — it cannot do `[ a \< b ]`, `fc`, or arithmetic across a newline; it exits where `command eval` should only set a status; it keeps literal quotes inside `${y:-"q r"}` and empty fields from unquoted `$@`; its exit status is 1 for every failure. The one row that is our choice is the status one: the ash family's 2 for a failed redirection, which DESIGN.md already lists and this now records in the table, so that a ksh script on z/OS testing `$?` against 1 is not a surprise.
* interactive: a prompt's width counts columns, not bytesSean Kurtz4 days1-1/+11
| | | | | | | | | | | | | | | | | | | | | The built-in editor skipped `ESC [ ...` sequences when working out where the prompt ends. Colour and titles are not all CSI: an OSC title or hyperlink runs to BEL or `ESC \`, DCS runs the same way, and `tput sgr0` is the three-byte `ESC ( B` before `ESC [ m`. A prompt built with `$(tput ...)` was measured wrong, which costs the cursor position and with it the wrapped-line arithmetic. `esc_seq_len()` in interact.c now walks what a terminal understands, and edit_builtin.c uses it. The libedit build shares the walk: it brackets control runs for `EL_PROMPT_ESC`, and adds the space libedit needs when a prompt ends in one, since libedit attaches a literal run to the character after it. bench/editor.py measures the two costs run.sh cannot see, start to first prompt and per-key echo, on a pty; bench/README.md has the table. The release, z/OS and fuzz builds move to -O3 while the sanitizer and coverage builds stay low: inlined frames make their reports harder to read than the few percent they would gain.
* docs: the z/OS tables and prose at 64-bit, C23 and the LPASean Kurtz4 days1-4/+4
| | | | | | | | | README's benchmark table is the 64-bit run with the run-time in the LPA and zsh installed (it was the 2.1-era table, and its zsh column was the 31 ms start-up, not zsh). bench/README.md keeps the 2.1 numbers as the history of what the LPA fixed, and gains the start-up table it now has a measurement for. investigation.md's §2 recommendation was still "build 31-bit"; it now says what happened instead.
* C23: nullptr for null pointers, constexpr for typed constantsSean Kurtz5 days1-2/+9
| | | | | | | | | | | | | | nullptr in every place a null pointer constant was meant; NULL is gone from src/. constexpr where it improves on #define without costing anything: the IGGCSI00 work-area offsets and sizes, and the scalar sizes MVS_DSN_MAX, CSI_FIELD_LEN, CSI_WORK_MIN, PDS_DIRBLK, CSI_WORK, CSI_MAX_CALLS. A constexpr in C is a constant expression, so it still bounds the arrays that use it, and it now carries a type and can be checked with static_assert. Feature switches (#if), the CSIETYPE/EBCDIC byte constants read as octets, and the related-constant enum sets stay as they were.
* C23: compile as C23 and use its spellingSean Kurtz5 days1-10/+16
| | | | | | | | | | | | | | | | | | | | | | | The z/OS toolchain would not take C23 when this was first written; IBM Open XL C/C++ 2.2 does (clang 21.1, __STDC_VERSION__ 202311), and so does the clang on Linux. -std=c23 in the Makefile, and the standard attributes in place of the ones that were macros: _Noreturn -> [[noreturn]] (on declarations and definitions) _Static_assert -> static_assert _Alignas -> alignas NODISCARD -> [[nodiscard]] FALLTHROUGH -> [[fallthrough]] PRINTFLIKE and UNREACHABLE() stay macros: [[gnu::format]] and [[gnu::unreachable]] are vendor attributes, and the standard has no [[format]] or [[unreachable]] for a header-only project yet. Standard-library additions newer than the libc of either system (<stdbit.h>, <stdckdint.h>) are not used, so gcc -std=c2x still builds the tree warning-free. The suite, ASan/UBSan and the z/OS lint pass as before; linux/i-dscomplete remains the one local failure it was on main.
* build: make the 64-bit z/OS build the defaultSean Kurtz5 days1-32/+39
| | | | | | | | | | | | | | | | | | | | | | zash is built 64-bit on z/OS now: -m64 for the ASCII and the EBCDIC build and for the debug build, and `make` as well as `make zash` land on zos-ascii there. The 31-bit build existed for the 64-bit start and fork costs, which were the C run-time being loaded out of the linklist; with CELQ* in the LPA the widths measure the same and the shell is built at the width IBM builds for. The catalog and dynamic-allocation modules are AMODE 31 and OS_UPSTACK does not exist at -m64, so both are declared with plain OS linkage, which is the 64-bit glue for an AMODE 31 callee. Neither module is installed on the test system, so that path is unverified there; csi_call() still catches a program check and retires the catalog. IGGCSI00's VL bit comes from the width of a pointer, not 0x80000000. Documentation follows: README gains a Recommendations section for the LPA change and loses the 31-bit rationale; DESIGN.md's cost model, catalog linkage and open questions match the measurements; bench/README states the current width and the rerun numbers; investigation.md records the decision.
* docs: humanize the markdown docsdocs/startup-probeSean Kurtz6 days1-101/+100
| | | | | | | | | Plain sentences where the prose had decorative bold lead-ins, em dashes and one-line closers. Claims, numbers and commands are unchanged, except two corrections that the startup probe settled: README said the remaining z/OS gap was the price of the address mode, and DESIGN's open question on `a | b &` said the gain depended on the address mode. Both are the 64-bit C run-time, not the address mode.
* docs: keep the probe write-up in notes/investigation.mdSean Kurtz6 days1-2/+3
| | | | | | The assembler-vs-C experiment, its method and the questions it leaves open get a tracked home outside the generated docs/ tree; bench/README keeps the result table and points there.
* docs: the 64-bit start-up cost is LE, not the address modeSean Kurtz6 days1-9/+13
| | | | | | | | | An AMODE 64 HLASM program that returns 0 without any C run-time starts in 0.8 ms, the same as the AMODE 31 copy, while the same empty program in C costs 29.4 ms at -m64 and 2.0 ms at -m32. So the 28 ms is Language Environment's 64-bit initialization, not the address space, and the 31-bit LE start is about 1 ms. Records the probe and corrects the claims in bench/README.md and DESIGN.md.
* fix: keep the Makefile readable by IBM makeSean Kurtz6 days1-3/+4
| | | | Remove ?= and $(shell) from the docs browser lookup, use $(MAKE) for recursion, and make the z/OS default naming explicit.
* Merge origin/main into docs/logo-and-cleandocs/logo-and-cleanSean Kurtz7 days1-55/+146
|\ | | | | | | | | | | | | Resolutions: README.md and DESIGN.md keep the new colour logo (packaging/zash-logo.svg) at width 220; the Makefile keeps main's newer shellcheck header, lists `make docs` in the usage block, and `clean` removes docs, cov and $(ZTOOLS) along with the branch's new tools.
| * z/OS: run 31-bit and load IGGCSI00 through the C librarySean Kurtz7 days1-54/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | zash was AMODE 64, so calling the AMODE 31 IGGCSI00 needed assembler glue (zos_csi.s) that switched addressing mode around the branch. Built with -m32 the program is 31-bit itself: the call goes through a plain function pointer, the work area and the saved registers live in one 31-bit block in C, and the glue is gone. The rest of the tree follows the change: the build, the off-z/OS lint shim, DESIGN.md and README.md, the benches, the Lean spec of the pattern matcher, and the tests that recorded what the extra address bits had changed.
* | docs: one centred logo, and clean removes what this makefile buildsSean Kurtz7 days1-0/+4
|/ | | | | | | | | | | README and DESIGN.md showed a light/dark <picture> pair, copied from a layout that had no centring; both now use packaging/zash-logo.svg inside a centred paragraph, the same header the typst spec already uses. make clean listed neither zash-debug nor fuzz-mvsfmt, so both survived a clean. The shellcheck directive at the top of the makefile now also covers the $(OBJS)-style expansions and the recipe `if` it reads as shell syntax.
* docs: say 31-bit, not below the barSean Kurtz10 days1-19/+39
| | | | | | "Below the bar" means below 16 MB, the 24-bit range. IGGCSI00 needs 31-bit addresses, so the block has to stay below 2 GB -- two very different limits. Corrected where the two had been confused.
* docs: the subshell row, and why a subshell can now skip its processSean Kurtz10 days1-0/+8
|
* docs: say it in short sentencesSean Kurtz11 days1-80/+101
| | | | | | | | | | | | | DESIGN.md, README.md and the Doxygen comments leaned on semicolons to join clauses and on trailing "which" clauses to add afterthoughts. Both read as machine-written prose. Each joined clause is now its own sentence, and the afterthoughts are either part of the sentence or a sentence of their own. Also corrected: README said C11 in two places (the tree builds C17), the completion section still described the pre-HLQ-rule filters and the 64-call resume limit, and the z/OS job-control note still called SPAWN_SETTCPGRP unverified.
* DESIGN: keep the table ASCIISean Kurtz11 days1-1/+1
| | | | | The z/OS working tree is Latin-1, so an em dash there breaks every git checkout on the machine.
* completion: stop guessing the HLQ for a bare //NAMESean Kurtz11 days1-1/+1
| | | | | | | `//NAME` completed against <user>.NAME, which meant assuming a TSO profile. It now offers nothing: only `//'DSN` and `//DD:` complete. The quoted member form keeps working, and the tests drop the relative cases.
* z/OS: give the EBCDIC build its own nameSean Kurtz11 days1-1/+2
| | | | | | | | Both zos-ascii and zos-ebcdic wrote ./zash, so `make zos-ascii` after an EBCDIC build was "up to date" and left the EBCDIC program in place -- which cost a debugging session: the "ASCII" binary on cbt was EBCDIC. ASCII is the build zopen uses and the one the tests run, so it keeps ./zash; EBCDIC is ./zash-ebcdic.
* zos_csi: keep the equates comment short and the file Latin-1Sean Kurtz11 days1-2/+2
| | | | | | HLASM wants every line inside column 71, so a two-line comment overran the continuation column and as reported ASMA144E. DESIGN.md picked up an em dash, which will not convert to the z/OS working-tree encoding either.
* Say the z/OS layer has been built and run thereSean Kurtz11 days1-15/+25
| | | | | | | | The docs and three source headers still claimed the z/OS layer had never been compiled. Both character modes build with ibm-clang, tests/zos/* run it on the machine, LE's heap checker stands in for ASan, and AMBLIST shows the CSI glue inside the program object. What is left is the set of things no test reaches, which the VERIFY notes already name.
* docs: the z/OS benchmarks, measuredSean Kurtz12 days1-4/+6
| | | | | | | | | | README carried "nothing has been compiled or run on z/OS yet", which stopped being true several commits ago, and promised z/OS numbers for the process-creation rows. Both tables are now measured: Linux against dash, bash, ksh and oksh, and z/OS against /bin/sh (IBM's ksh88 port), bash, zsh and oksh. Small pipelines and $( ) cost z/OS up to 277 s where zash stays near ksh88's 19 s; plain external commands cost the same for both.
* docs: space the table delimiter rows so markdownlint stops complainingSean Kurtz12 days1-9/+9
| | | | | | Every table used |-|-| with spaced cells, which MD060 reads as a compact table and flags on every pipe; 11 delimiter rows normalised, plus one 84-column paragraph reflowed. Prose unchanged.
* z/OS: dbx, an AMBLIST map and heap-checked test runsSean Kurtz12 days1-2/+2
| | | | | | | | | | | | | lldb is not on z/OS, so the debug story there is dbx, which needs -g and an unoptimised load: make zos-debug builds ./zash-dbg, zos-dbx runs it, zos-attach attaches to a running shell and zos-dump reads a dump (SVC and SYSMDUMP only: dbx does not read SYSUDUMP or CEEDUMP). AMBLIST maps CSECTs, AMODE/RMODE and entry points of a program object, which is the one question a debugger cannot answer from source: make zos-amblist lists ./zash and the HLASM routine's object module. The docs catch up with C17 and the new targets.
* Hardening: ENV expanded and ignored for set-ID shells; no truncated profile pathSean Kurtz12 days1-48/+47
| | | | | | | POSIX: ENV is parameter-expanded, and not used when the real and effective user or group IDs differ. The expansion reuses the prompt's contained expansion (expand_quietly), so a bad ENV cannot unwind into startup. $HOME/.profile is not sourced if the path would be truncated.
* z/OS builtins: tag, alloc, freeSean Kurtz2026-11-151-0/+9
| | | | | | | | tag shows and sets file tags in chtag -p form without a process; alloc and free pass BPXWDYN requests. They exist only in z/OS builds (free must not hide procps elsewhere) and in make mvs-asan's build, which runs their usage-error test; tests/zos/builtins.sh covers the real work (unrun, VERIFY).
* Docs: tagging, CSI completion, z/OS options, off-z/OS checking; tagging benchSean Kurtz2026-11-151-18/+194
| | | | | | DESIGN.md gains the reference for file tags and conversion, MVS name completion and the CSI glue's storage layout, the per-command z/OS options, and how z/OS code is checked on Linux. bench/tagging.sh measures tagging cost on z/OS (n/a elsewhere).
* Docs: C11, coding style, extensions, interactive layer, job controlSean Kurtz2026-11-131-44/+219
|
* zash: scripting core, test suite and benchmarksSean Kurtz2026-11-121-0/+475
A clean-slate POSIX shell for z/OS UNIX in the Almquist tradition, written in C23 for Clang (Linux) and IBM Open XL C/C++ (z/OS). - Parser, expansion, arithmetic, redirection, traps and builtins. - Spawn-first execution: fd plans instead of fork+dup2, in-shell pure builtins for pipelines and command substitution, $(a | b) without a subshell. - Flat .POSIX Makefile; asan, valgrind, bench, compdb and z/OS targets. - Tests: posix (dash-generated), zash, process accounting, linux, zos. Nothing has been compiled or run on z/OS yet.