summaryrefslogtreecommitdiffhomepage
path: root/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* fix(webdocs): make a script out of the page maker, and test itSean Kurtz2 days1-32/+16
| | | | | | | | | | make reads a `$` in a recipe as a variable reference, so the awk program that stripped the logo, the author line and the contents list arrived without its `$`, the README page came out empty and `make webdocs` said nothing. The page maker is now web/site-page.sh, which also names the page after the document rather than after the path the Makefile happened to pass, and tests/scripts/webdocs.sh checks the result: front matter, no logo or contents list, links rewritten.
* tests: pin the CSI type byte in both character sets, and a gzip archiveSean Kurtz2 days1-5/+26
| | | | | | | | | | | | | | | | | The CSI entry type byte is converted from EBCDIC in an ASCII build and must be used as it is in an EBCDIC build (notes/review-2026-11-27.md, item 12). Nothing but Tab completion on z/OS reaches that code, so the test drives the decoder directly: tests/tools/csi.c builds a work area with one data set, one user catalog connector and one catalog entry, and asks csi_parse() for the names. On z/OS the Makefile builds it twice, once per character set, and tests/zos/csi-parse.sh runs both; each prints a verdict, so one expectation covers both builds. tests/zos/tagging.sh gains the case the review asked for: a gzip archive made through zash (with its stdout tagged and converting) must be byte for byte the archive /bin/sh's redirect makes. It is: gzip turns conversion off for its own output, and the 1047 tag is the one /bin/sh leaves on this host too (_BPXK_AUTOCVT=ON, _CEE_RUNOPTS=FILETAG(AUTOCVT,AUTOTAG)).
* web: a design pass, and documents that stand on their ownSean Kurtz2 days1-7/+17
| | | | | | | | | | | | | | | | | 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-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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).
* web: the specification as a page, converted from typst's HTMLchore/c23-idiomsSean Kurtz4 days1-2/+13
| | | | | | | | | | typst writes no markdown, so the site had the typeset HTML export and no page that a reader could search or link into. web/spec-md.py reduces the export to what goldmark reads and hands it to pandoc, then puts back the heading ids the spec cross-references itself by and carries the MathML over untouched: browsers render it, so the page ships no TeX script. `make docs` writes it with the other document pages, and the site stays hand-written pages until someone runs that.
* interactive: a prompt's width counts columns, not bytesSean Kurtz4 days1-3/+6
| | | | | | | | | | | | | | | | | | | | | 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.
* z/OS: make zash and make parse under POSIX make againSean Kurtz4 days1-7/+19
| | | | | | | | | | | | | | | | b786aac put a GNU conditional inside the zash rule. z/OS /bin/make is IBM POSIX make: it has no ifeq and no $(shell), so plain make and make zash both stopped at line 124 with FSUM8232 before any target ran. The rule also required $(OBJS), and that names src/sys_posix.o, which uses posix_spawn and does not compile on z/OS. The prerequisites are now the sources; on Linux they are newer than the objects exactly when zash-posix has work, so the delegation is a no-op once built. The new test pins ZOS_SYSNAME and ZOS_SYSPLEX against sysvar(1), and the shape of ZOS_RELEASE, ZOS_ASID and ZOS_JOBNAME, whose values belong to the one process. zos-lint now rejects GNU-only make syntax, so a conditional cannot come back unnoticed.
* Makefile: make zash on z/OS links the 64-bit build itselfSean Kurtz4 days1-2/+12
| | | | | exec-ing into make zos-ascii hung here with no child processes, and the shell target is the same command line anyway.
* C23: constexpr internal linkage, naming and trailing commas; clangd at C23Sean Kurtz4 days1-8/+55
| | | | | | | | A constexpr at file scope has external linkage, so the CSI offsets and CSI_MAX_CALLS now say static. The naming check gets the C23 spellings wrap the check itself: typed constants keep the macro case, and a local static constexpr table keeps the variable case. .clangd says -std=c23, which it still did not, so the editor could not read constexpr at all.
* repo: drop patches/, move spec-pdf.sh out of scripts/Sean Kurtz5 days1-1/+1
| | | | | | | patches/ held one file, a byte-identical copy of LICENSE; no port patches anything (ZOPEN_TYPE=LOCAL builds the checkout). The single script was the typst spec builder, which is a build step, so it lives beside the other build machinery.
* C23: compile as C23 and use its spellingSean Kurtz5 days1-1/+1
| | | | | | | | | | | | | | | | | | | | | | | 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-1/+8
| | | | | | | | | | | | | | | | | | | | | | 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.
* build: 64-bit on z/OSSean Kurtz5 days1-6/+7
| | | | | | | | | | | | | | | | | | The 31-bit choice existed for one reason: a 64-bit start cost 29 ms against 1 ms and a 64-bit fork() 4.2 ms against 0.10. That was the 64-bit C run-time being loaded out of CEE.SCEERUN2 on the linklist on every start; with CELQ* in the dynamic LPA both widths cost 1.5 ms and fork() 0.10 ms (notes/investigation.md has the before and after). So build the shell at the width IBM builds for: -m64 for both the ASCII and the EBCDIC build, and for the debug build. OS_UPSTACK does not exist at -m64, so the two AMODE 31 services (IGGCSI00, BPXWDY2) are declared with plain OS linkage, which is what the 64-bit glue implements. IGGCSI00's VL bit is set from the width of a pointer now, not with 0x80000000. Neither module loads on this system, so the linkage itself stays unverified; csi_call() still traps a program check and retires the catalog if it abends.
* Measure why 64-bit start-up is slow, and record the answer (#16)Sean Kurtz5 days1-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bench: time one start with a parent that is not an LE program `bench/startup.sh` times a shell loop, so on z/OS every child pays the 31-bit shell's own price and the 64-bit start-up cost cannot be separated from it. `tests/tools/spawn` forks one child at a time and reports wall and child CPU per start, and `bench/le-init.sh` builds the 31-bit, 64-bit and HLASM programs it times in a work directory, so the table needs nothing checked in but the script. The child's environment is built by hand and passed to `execve`: `putenv` after LE has initialized is not handed to the child, and `_CEE_RUNOPTS` exported to an LE parent makes that parent's `execl` fail, which a fork loop that does not check exit status reports as a fast start. * notes: the 64-bit start-up cost is LE waiting, not the address mode Measured on the CBT z/OS 29.00 system: a 64-bit HLASM program with no LE starts in 1.39 ms, the same source at -m32 in 1.5-1.8 ms, so the address space, the loader and XPLINK are free. A -m64 start spends 4.5-28 ms before the first instruction of main, of which only 1.0-1.25 ms is charged to the child: the rest is wall time on something shared, which does not overlap between concurrent starts while it is at 28 ms and does once it drops to 5.8 ms. No _CEE_RUNOPTS option moves it. That retracts an earlier POSIX(OFF) result in these notes: exporting the option to an LE parent makes its execl fail, so the run timed failed execs. Applied to the child, POSIX(OFF) changes nothing.
* Merge pull request #15 from skurtz97/bench/startupSean Kurtz5 days1-1/+16
|\ | | | | bench: measure start-up wall time against the other shells
| * bench: measure start-up wall time against the other shellsSean Kurtz5 days1-1/+16
| | | | | | | | | | | | | | | | | | | | | | run.sh times CPU, so the milliseconds a process spends before it runs anything never appear in it: zash can read 0.00 in a subshell row while zash -c : costs a few ms of wall time. bench/startup.sh measures that directly, one start per command, and bench/README.md now has a table instead of a warning that the number is missing. The clock is tests/tools/now.c, ten lines, because /bin/date on z/OS has no sub-second format.
* | Merge pull request #14 from skurtz97/test/zos-leakcheckSean Kurtz5 days1-2/+20
|\| | | | | test: fail when zash leaks under LE's heap checker
| * test: fail when zash leaks under LE's heap checkerSean Kurtz5 days1-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | HEAPCHK with a call depth and no per-call walk makes LE write the heap storage diagnostics into a CEEDUMP at normal termination: every allocation still live at exit, with the traceback that made it. A shell leaves working storage live on purpose, so the total says nothing by itself; a leak shows as the total growing with the work done. tests/zos/leak.sh therefore runs one builtin-only loop body at 100 and 1000 iterations in the same shell, sums the live bytes out of each report, and fails if the second run is more than 2 KiB larger. `make zos-leakcheck` is the target: it points _CEE_DMPTARG at build/leaks and skips zash/limits, which recurses deep enough to run out of storage under the checker.
* | fix: stop make check after the z/OS test passesSean Kurtz6 days1-2/+5
|/
* fix: make the zopen build use GNU make and install without rebuildingSean Kurtz6 days1-1/+3
|
* fix: keep the Makefile readable by IBM makeSean Kurtz6 days1-8/+13
| | | | 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 Kurtz6 days1-38/+110
|\ | | | | | | | | | | | | 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-37/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | make: add other-docs, and bring the usage comment up to dateSean Kurtz6 days1-5/+25
| | | | | | | | | | | | | | | | | | | | | | make other-docs runs the documentation that needs a tool z/OS does not have: the specification through typst, the source reference through Doxygen. The comment at the top listed fourteen of the targets and missed the rest; it lists them all now, grouped the way the file is, with the argument each one takes where it takes one. Doxygen's output is doc/, not docs/, which the comment had wrong.
* | formal: typeset the spec from a script, and with the new coverSean Kurtz6 days1-1/+5
| | | | | | | | | | | | | | | | | | | | formal/zash-spec.pdf could not be rebuilt from anything in the tree. scripts/spec-pdf.sh does it: the typst CLI when present, the Python package otherwise, with the repository root as typst's root so the cover can reach ../packaging/zash-logo.svg. `make spec` runs it. The PDF is rebuilt from the same source, so the cover carries the new logo; the page count is unchanged at 27.
* | docs: one centred logo, and clean removes what this makefile buildsSean Kurtz6 days1-3/+5
|/ | | | | | | | | | | 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.
* z/OS: a wider spawn map, and the suite runs both buildsSean Kurtz11 days1-2/+3
| | | | | | | | | The map carried SYS_NFD+16 descriptors, so a script holding more pushed the terminal's duplicate out of reach and its commands lost the controlling terminal. 64 leaves room. `make zos-check` now builds the EBCDIC program too and runs the character-set tests against it, which nothing did before.
* z/OS: give the EBCDIC build its own nameSean Kurtz11 days1-1/+5
| | | | | | | | 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.
* Document what dbx and AMBLIST actually do hereSean Kurtz12 days1-4/+7
| | | | | | | | Checked on the mainframe: `make zos-debug` builds, `st in main` stops at src/main.c:401 with the source shown, and next/where keep reporting file and line, but `st at "file":line" cannot resolve the source on ibm-clang's debug info. `make zos-amblist` writes a 48545-line map of ./zash (RMODE ANY, XPLINK, PO format 4, main entry AMODE 64).
* Makefile: zos-debug exists, and zos-amblist names the object it mapsSean Kurtz12 days1-1/+3
| | | | | The rule was zash-dbg, and the AMBLIST target asked for zos_csi.o where every other rule says src/zos_csi.o.
* Makefile: use plain `NAME = value` so z/OS make can read itSean Kurtz12 days1-5/+8
| | | | | | z/OS make rejects `?=` outright (FSUM8232, nothing builds), so go back to the assignment form the rest of the file uses and tell the linter, which reads makefiles as shell, that this is make syntax.
* z/OS: dbx, an AMBLIST map and heap-checked test runsSean Kurtz12 days1-4/+49
| | | | | | | | | | | | | 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.
* z/OS: check the heap the way z/OS canSean Kurtz12 days1-0/+9
| | | | | | | | | | | | There is no ASan there, but Language Environment can put a check zone after every heap element (above and below the 2 GB bar) and validate the heap on every request: an overlay then abends with U4042 and prints CEE3716I instead of staying silent. A small C program that writes 8 bytes past a malloc() calibrated the options against the real system. tests/zos/fuzz.sh now runs its 200 cases under those options, and make zos-heapcheck runs the whole suite under them. Its generator also stays inside 32 bits now, so /bin/sh can run the script too.
* Build with C17 on every platformSean Kurtz12 days1-1/+1
| | | | | | | | | | C17 is C11 plus its defect reports, so no source changes; what it buys is the current z/OS compiler's documented language level rather than the provisional C11 of earlier releases. Verified with clang (clean) and gcc (only the pre-existing -Wclobbered warnings in src/exec.c and src/trap.c), and with make zos-lint. The Linux suite is unchanged at 93 passed and linux/i-startup failed.
* Fixes for z/OS build and signals.Sean Kurtz12 days1-4/+13
|
* fix issues with z/os build, header visibility, signalsSean Kurtz12 days1-1/+5
|
* Added LLDB debug builds and support to Makefile and VSCode.Sean Kurtz12 days1-0/+23
|
* z/OS: file tagging, catalog completion, time, and per-command optionsSean Kurtz2026-11-151-11/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tagging and conversion (sys_zos.c, redir.c, input.c, var.c, exec.c): - _TAG_REDIR_IN/OUT/ERR as /bin/sh documents them, cached by variable hooks so redirection tests a byte; honoured as a prefix on external commands and on pipeline stages. - ASCII builds tag new output and here-document files as text, tag pipes IBM-1047 (set +o pipetag to stop), and switch on autoconvert. - Scripts, . files, profile and ENV are read in either character set: tagged files get F_CONTROL_CVT, untagged ones are sniffed. - tag/chtag primitives (sys_tag_get/sys_tag_set) for a builtin to come. Data set completion (complete.c, mvsfmt.[ch], zos_csi.s): - //'HLQ.PART, "//'HLQ.PART, //NAME (user HLQ), //'DSN(MEM, //DD:NAME complete one qualifier at a time from the Catalog Search Interface, PDS directories and the TIOT. - IGGCSI00 is called through HLASM glue that switches to AMODE 31 and keeps every register and parameter below the bar (VERIFY). - The work-area, directory and TIOT decoders are portable and run on Linux against a stand-in catalog that produces the real EBCDIC bytes, including CSI resume and directory-block splits; fuzzed with libFuzzer (make fuzz). - A lone completion inside quotes now closes the quote. Other z/OS features: - time [-p] keyword with shell/children CPU split. - set -o jobnames (_BPX_JOBNAME per command), set -o shareas (_BPX_SHAREAS=YES for foreground commands only), set -o msgid (ZSHnnnnE/W message IDs), ulimit -M (MEMLIMIT), ZOS_SYSNAME, ZOS_SYSPLEX, ZOS_RELEASE, ZOS_ASID, ZOS_JOBNAME, prompt \S. - BPXWDYN entry point for an alloc builtin to come. Checking z/OS code off z/OS: - make zos-lint compiles sys_zos.c against declarations transcribed from the z/OS headers, and the rest with the MVS paths forced on. - make mvs-asan runs the suite with the MVS paths on, under ASan/UBSan. - make asan and make valgrind now check for leaks.
* Add [[ ]], make coverage, and fixes found by edge-case testsSean Kurtz2026-11-151-4/+19
| | | | | | | [[ ]] is parsed into a tree and evaluated without argv or lookup. Fixes: errexit inside a tested subshell, the ${x:?} message, arithmetic on variables holding expressions, printf %c of an empty argument, job text for arithmetic, and \n and \e prompt escapes.
* Add extensions, job control and the interactive layer; convert to C11Sean Kurtz2026-11-131-18/+36
| | | | | | | | | | | | | | | | | Language: $'...', aliases, function keyword, (( )) and let, typeset and integer, print, whence, setvar, ulimit, read -t, RANDOM, SECONDS, the ERR trap, trap -p, chdir, and more set -o names. Job control: a job table, process groups, terminal hand-over through the spawn layer, jobs/fg/bg, wait %n and kill %n. Interactive: prompt expansion, a built-in line editor with emacs and vi modes, completion, history with fc and HISTFILE, and libedit as a compile-time alternative (make EDIT=libedit LDLIBS=-ledit). The source is now C11 (was C23), uses typedef'd structs and enums, and has Doxygen comments throughout. Adds .clang-tidy, .clangd and a Doxyfile.
* zash: scripting core, test suite and benchmarksSean Kurtz2026-11-121-0/+113
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.