summaryrefslogtreecommitdiffhomepage
Commit message (Collapse)AuthorAgeFilesLines
* DESIGN: record what the z/OS run actually does nowfix/zos-spawn-fdmapSean Kurtz7 days1-5/+6
| | | | | | | The paragraph said two signal tests fail under zos-heapcheck and pass under zos-check. With the fd map fixed, zos-check is green in full, and the heapcheck failure that remains is one intermittent case in scripts/signals, which passes when run on its own.
* z/OS: keep a close-on-exec pipe out of the child's fd mapSean Kurtz7 days3-5/+40
| | | | | | | | | | | | | | | | | | | | | | | sys_pipe() duplicates the shell's pipe ends above SYS_NFD and marks them FD_CLOEXEC, so that other children do not inherit them. spawn()'s fd_map hands the child the parent's descriptor as it is, without clearing the flag the way dup2() would, so a mapping onto the child's 0..2 carried FD_CLOEXEC into the child. The child could still write, but the next exec inside it lost stdout: ps printed FSUM6004 write error on standard output: EDC5113I Bad file descriptor and a #!/bin/sh shim lost the pipe it was given. Pass a plain duplicate, which fcntl F_DUPFD makes above SYS_NFD without the flag, for every map entry that names a different descriptor, and close the duplicates once spawn() has made the child. Entries that map a descriptor onto itself are untouched. tests/zos/fdmap.sh records the case: a pipe the shell made, read by a child that execs. Reported in #1.
* z/OS: run 31-bit and load IGGCSI00 through the C librarySean Kurtz7 days26-324/+1401
| | | | | | | | | | | | | 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.
* typst: fix some issues with formatting around code blocks.Sean Kurtz9 days5-27260/+5059
|
* formal: moved all spec docs inside new formal directory for working on ↵Sean Kurtz10 days4-0/+1
| | | | verification.
* added new benches, the logo, and a formal spec for possible verification.Sean Kurtz10 days12-1/+13704
|
* docs: say 31-bit, not below the barSean Kurtz10 days3-21/+42
| | | | | | "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.
* z/OS: load IGGCSI00 once and keep the block for the shellSean Kurtz10 days3-72/+120
| | | | | | | | | | | | | | | | | | | | The search interface was reached through LINK, which asked the system to find and attach the module on every call -- and completion issues a call per Tab. The glue now LOADs the module on the first call, writes its entry point into the block, and branches to it directly afterwards, and the block itself is taken from 31-bit storage on the first search and kept, because IGGCSI00 is AMODE 31 and all three of its addresses have to stay below 2 GB. The block is declared packed, so the compiler cannot add padding the assembler's offsets do not know about, and aligned(8), so the save area starts on a doubleword. Its name field is spelled in IBM-1047 bytes rather than as a C string, so the module is named the same way whatever character mode this build runs in. Verified on the machine: SYS1.MA* returns SYS1.MACLIB, SYS1.* returns 135 names, and Tab in an interactive shell completes //'SYS1.MA to //'SYS1.MACLIB' and lists the members of that PDS.
* README: the subshell row, from the run against ksh88Sean Kurtz10 days1-3/+3
|
* docs: the subshell row, and why a subshell can now skip its processSean Kurtz10 days2-1/+9
|
* README: the subshell row, after running it in the shellSean Kurtz10 days1-12/+11
|
* docs: keep the source ASCII, which the z/OS working tree needsSean Kurtz10 days1-1/+1
|
* exec: run a subshell in process when its body cannot change anythingSean Kurtz10 days4-1/+57
| | | | | | | | | | | | | | A `fork()` copies the address space on z/OS, where a `spawn()` can share it. The subshell row measured 4.7 ms a turn there against 0.3 ms for an external command, and ksh88 does not fork for `( : )` at all. The pipeline stage check already answered the safety question with is_pure(), so a subshell whose body is one output-only builtin with no redirections and no assignments reuses the answer and runs in the shell. Expansion of the arguments is wrapped in the same capture scope a pipeline stage uses, so ${x=1} no longer escapes. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* README: the whole benchmark set, on both platformsSean Kurtz10 days1-40/+63
|
* bench: 200 background jobs, which is what z/OS lets a shell forkSean Kurtz10 days1-1/+1
|
* clangd: keep its clang-tidy view in step with .clang-tidySean Kurtz11 days1-0/+7
| | | | | | | | Two checks disagree with how this tree is written: if (ptr) is the house style for a null test, and _Static_assert, _Noreturn and _Alignas are C11 keywords whose spelling the standard fixes. .clang-tidy already allows the first and switches off the second, but clangd applies those options unevenly between clang-tidy versions, so it named both anyway.
* Revert the pi-lens config out of the treeSean Kurtz11 days1-7/+0
| | | | | Editor and linter policy belongs in the user's own configuration, not in this repository.
* bench: more of what a script actually doesSean Kurtz11 days13-0/+20135
| | | | | | | | | | | | | Eleven more benchmarks, each one a subsystem rather than a syntax form: here-documents, getopts, redirections, subshells, background jobs, printf, parameter expansion, IFS field splitting, case dispatch, recursion, and bash-style ${v/a/b} substitution. They print one line that every shell must agree on, so they are tests too, and the harness reports n/a where the shell lacks the feature. .pi-lens.json turns off its reserved-identifier rule: every match in this tree is a C11 keyword (_Static_assert, _Noreturn, _Alignas) or a runtime name (_exit, __malloc31, _CVSCSID) that has to be spelled that way.
* tests/zos/ebcdic: drop the external sort from the collation testSean Kurtz11 days2-4/+2
| | | | | | | /bin/sort collates by the environment's collation, not by EBCDIC byte order, so on z/OS it put the digits first and the test failed the first time it ran in the EBCDIC build. The shell's own ordering, which is what the test is for, is checked above it.
* bench: the numbers, measured against ksh88 by nameSean Kurtz11 days1-19/+40
| | | | | | | The z/OS column was headed /bin/sh, which read as any old sh and hid that it is IBM's ksh88 port. Both tables are re-measured with the new report and deploy scripts, and the [[ ]] and (( )) rows are split apart, since ksh88 has the first and not the second.
* bench: a probe must fail when the feature is missingSean Kurtz11 days1-1/+3
| | | | | | An if with no else clause answers 0 even when its condition failed, so dbracket's probe reported success on dash and the row said differs instead of n/a. The probe now says so itself.
* bench: keep the arithmetic totals inside 32 bitsSean Kurtz11 days14-2/+17
| | | | | | | ksh88 works in 32-bit integers, so summing i*2 over 200000 iterations overflowed and the benchmark reported "differs" instead of a time: the same script, two answers. Summing (i % 100) * 2 does the same work and fits in 31 bits.
* bench: name the columns, and run the ksh features against ksh88Sean Kurtz11 days4-16/+65
| | | | | | | | | | | | The column for z/OS /bin/sh said sh, which hid that it is IBM's ksh88 port, and two benchmarks skipped it for the wrong reason: dbracket probed [[ ]] with eval, which ksh88 rejects even though [[ ]] works, and arithcmd used (( )) as a command, which is ksh93 and not ksh88. run.sh now takes shell=label arguments and labels /bin/sh as ksh88 on z/OS, and BENCH selects a subset. dbracket probes the form it uses. arithcmd keeps to typeset -i, let and $(( )), so ksh88 runs it, and the (( )) command form moved to dparen.sh.
* tests/zos/security: ask whether the redirect was refused, not howSean Kurtz11 days2-3/+6
| | | | | | zash exits 1 for a failed redirection on Linux and 2 on z/OS (the errno is mapped differently there). What the test is about is that the command fails, not the number it fails with.
* tests/zos/security: set PATH, and drop the read-only directory checkSean Kurtz11 days2-9/+8
| | | | | | | | | z/OS profiles end PATH with a colon, which POSIX reads as the current directory, so the PATH check passed for the wrong reason there. The ZFS test also let the owner create files in a directory it had just chmod'ed 500, so that check proved nothing on the machine it was written for. A redirection into a missing directory tests the same error path and is refused everywhere.
* Readme icon and contents, a security test, realistic bench scriptsSean Kurtz11 days5-1/+134
| | | | | | | | | | | | | | | | | README.md shows the shell's icon on a light or dark background, has a table of contents, and says C17 rather than C11 (the tree has built C17 since b4d6bf1). tests/zos/security.sh is the security-relevant half of the suite: a file created by redirection or mkdir takes the umask, a redirect into a directory without write permission fails, the current directory is not searched for a command, ENV is not read by a non-interactive shell, and neither an expansion nor a file name is re-parsed. bench/report.sh counts a generated log by level and hour, and bench/deploy.sh renders and verifies 100 configs from a template. Both are realistic scripts and both are compared for output against other shells by bench/run.sh, so they fail as tests as well as being timed.
* docs: say it in short sentencesSean Kurtz11 days32-280/+302
| | | | | | | | | | | | | 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.
* completion: no catalog search until a high-level qualifier is completeSean Kurtz11 days5-35/+117
| | | | | | | | | | | | | | | A filter whose first qualifier is generic makes Catalog Management resolve aliases generically, and the manual warns that a generic high-level qualifier can select several catalogs at once: a high-level of "**" means every user catalog. Tab is no reason to ask that of the catalog address space, so completion waits until a whole high-level qualifier is typed before it searches at all. The searches are narrower too: entry types U (user catalog connector) and X (alias) are excluded, since they are not data set names; the required return-area length is checked before a resume, as Managing Catalogs asks; and the editor lists at most one screenful of candidates, with a count of the rest, instead of a fixed 200.
* z/OS: one catalog per completion search, and stop after two callsSean Kurtz11 days3-4/+36
| | | | | | | | | | | | | | CSIS1CAT keeps a generic high-level qualifier from fanning a Tab key out over every alias it matches plus the master catalog, which is what Managing Catalogs warns about for CSIFILTK with generic filters. Two IGGCSI00 calls already return about 2200 names -- one call fills the 64000-byte work area with ~1100 -- so 64 was sweeping a whole catalog per keystroke for names no screen could show. Also: `//'<tab>` searched for "*" and "*.*" before the filter check refused them; it now returns before allocating anything, and tests/run.sh can compare an EBCDIC build's transcript against a .ebcdic.exp.
* tests/zos/fdmap: the output of the descriptor sweepSean Kurtz11 days1-0/+2
|
* z/OS: test a spawn with the script's whole descriptor range openSean Kurtz11 days2-17/+9
| | | | | | | A script owns descriptors 0..SYS_NFD-1 and the shell's own live above them, so filling 3..9 is as far as a script can go; the spawn map keeps the terminal duplicate reachable past them. The earlier '64' map was guessing at a case the shell cannot present: back to SYS_NFD+16.
* z/OS: bound the below-the-bar storage CSI completion usesSean Kurtz11 days2-7/+17
| | | | | | One 64 KB block, freed before the search returns, and a nested search is refused rather than given a second one. The second catalog search is skipped once the candidate list is full.
* z/OS: a wider spawn map, and the suite runs both buildsSean Kurtz12 days3-5/+30
| | | | | | | | | 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.
* DESIGN: keep the table ASCIISean Kurtz12 days1-1/+1
| | | | | The z/OS working tree is Latin-1, so an em dash there breaks every git checkout on the machine.
* completion: bound the name before searching for itSean Kurtz12 days1-1/+2
| | | | | | GCC's -Wformat-truncation is right: the search patterns are built from the typed word, so check its length first. The pwd.h include went with the HLQ code it served.
* completion: stop guessing the HLQ for a bare //NAMESean Kurtz12 days4-70/+17
| | | | | | | `//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 Kurtz12 days3-3/+8
| | | | | | | | 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.
* input: a tty that answers lseek() is still a ttySean Kurtz12 days1-3/+3
| | | | | | | | | A z/OS terminal is seekable, so stdin was classified as a script: no prompt, no line editing, no `bind`, just the driver's own echo. Ask isatty() first; only a non-tty can be seekable. Found with ~/tmp/tty.c on cbt: on a pty `isatty(0)=1 isatty(2)=1 seek=1`.
* editor: `bind`, and prompts that take bash's \[ \] markersSean Kurtz12 days10-17/+276
| | | | | | | | | | | | | | `bind -l` lists the actions the editor can run and `bind '^[[H'=beginning-of-line` gives one to a key sequence, in the notation the BSD shells use. Only the names edit_key() already knows are accepted, so a binding cannot do anything a key could not; `-m` (macro) is refused rather than ignored. The defaults stay bash's: this is for people whose .kshrc moves the arrow keys, not a move towards ksh. `\[` and `\]` in PS1 say "this part does not move the cursor". The width rule already skips control sequences, so dropping the markers is the whole implementation, and a coloured prompt now shows its text instead of the markers.
* editor: rewrap a header comment to 80 columnsSean Kurtz12 days1-4/+4
|
* z/OS: keep the terminal descriptor open for spawnSean Kurtz12 days1-2/+18
| | | | | | | | | | | | spawn() sets the child's foreground process group from inherit.ctlttyfd after it has closed every descriptor from fd_count up, so the shell's terminal descriptor -- which lives above the script's five or so -- was already gone by then. Every external command in an interactive shell died with EDC5113I Bad file descriptor, while the same command outside a terminal worked. Carry the terminal descriptor in the fd map, so the child has it open for exactly the tcsetpgrp() spawn() performs.
* edit_builtin: the emacs keys bash users reach forSean Kurtz12 days3-2/+102
| | | | | | | | meta-u, meta-l and meta-c change the case of a word, meta-t transposes the words either side of the cursor, meta-. inserts the last word of the previous line and meta-\\ collapses the blanks around the cursor. The rest of the map was already bash's: a BSD sh or a bash prompt is the target, not ksh's.
* sys_zos: no /* inside the block commentSean Kurtz12 days1-2/+2
| | | | | -Wcomment is right: a path spelled tests/zos/* starts a nested comment marker.
* zos_csi: keep the equates comment short and the file Latin-1Sean Kurtz12 days2-4/+3
| | | | | | 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.
* zos_csi: name the registers the way HLASM sources doSean Kurtz12 days1-11/+32
| | | | | Equates at the bottom (R0 EQU 0 ... R15 EQU 15) and R<n> in every operand field, so the code reads as registers rather than numbers.
* linux/i-startup: do not depend on the host /etc/profileSean Kurtz12 days1-2/+7
| | | | | | | | A login shell reads /etc/profile before ~/envfile, and a distribution's copy is bash-flavoured: it fails on a substitution only bash accepts and it sets USER from the account database, so \u printed the real user. The ENV file now sets USER back, and the host's own diagnostic is dropped from the transcript.
* Say the z/OS layer has been built and run thereSean Kurtz12 days4-21/+33
| | | | | | | | 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.
* clangd: tell the editor the tree is C17, as the Makefile doesSean Kurtz12 days1-1/+1
|
* Read startup files like the interactive shell they belong toSean Kurtz12 days5-3/+39
| | | | | | | | | | | A failing line in $ENV ended the shell: run_input() only installed its recovering handler for the main loop, so sh_error() found no handler and called exit_shell(). An interactive shell must not exit for a command that fails (POSIX 2.5.3), and a .kshrc shared with ksh is full of lines zash rejects. Startup files now run with RI_RECOVER, which recovers from an error without printing a prompt, and the rest of the file is still read.
* README: a roadmap, with man pages firstSean Kurtz12 days1-0/+20
|