diff options
| author | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-25 21:22:07 -0600 |
|---|---|---|
| committer | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-25 21:22:07 -0600 |
| commit | d9ea106455acb97d06607e74d5ec0bafb7ad3f6b (patch) | |
| tree | fc0832812ca0d128650db86cf53c3084f80a3453 | |
| parent | 6ef928c4d698478997057b107076d65720cfbcdd (diff) | |
| download | zash-bench/compat-triage.tar.gz | |
bench: read the 28 differences from the host's shbench/compat-triage
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.
| -rw-r--r-- | DESIGN.md | 6 | ||||
| -rw-r--r-- | bench/README.md | 34 |
2 files changed, 37 insertions, 3 deletions
@@ -835,6 +835,12 @@ Rules: not). - Exit statuses follow the ash family: 2 for a failed redirection, 127 from `type` and `command -v` for an unknown name. +- The z/OS `/bin/sh`'s semantics are not emulated where it departs from + POSIX and every other shell: `[ a \< b ]`, `fc`, arithmetic across a + newline, an unterminated here-document, unquoted `$@` keeping empty + fields, and `command eval` still exiting on an error. `bench/README.md` + classifies every difference the two shells show on the `tests/posix` + corpus, and none of them is a zash bug. - An expansion error in a command the shell prepares for a child (a pipeline stage, `&`, `$( )`) is reported on the shell's stderr, not on the stderr that command would have had. diff --git a/bench/README.md b/bench/README.md index c984b31..bb290a7 100644 --- a/bench/README.md +++ b/bench/README.md @@ -268,6 +268,10 @@ It matters for anything that starts zash often: a script with a `#!` line, `zash -c`, a spawned subshell. It does not matter for a long interactive session. +Measured with 100 starts each: `-c :` is a bare start, `script` is the +kernel starting the shell on a one-line file, which is what a `#!` line +does. + ## The host's sh `compat.sh` runs every `tests/posix` script under zash and under the @@ -287,9 +291,33 @@ found` where zash says `not found`), and the rest are behaviour worth reading one at a time. Linux numbers are lower-information, because `/bin/sh` there is usually bash while the `.exp` files come from dash. -Measured with 100 starts each: `-c :` is a bare start, `script` is the -kernel starting the shell on a one-line file, which is what a `#!` line -does. +Every one of the 28 has been read, and none of them is a zash bug: zash +agrees with dash on all 38 (that is what the suite says), and the +falling-out is the IBM shell's. The groups: + +| Scripts | What IBM sh does | POSIX / other shells | +| --- | --- | --- | +| charset, collate.ascii, test-ops | `[ a \< b ]` fails with `FSUM6807 expression syntax error` | required by POSIX since 1992 | +| functions, func-edge | arithmetic that spans a newline is `FSUM7425 unknown operator` | whitespace, as in every other shell | +| readcmd | no `fc`, so `$(fc ...)` is `FSUM7351 not found` | `fc` is a POSIX special builtin | +| invoke | a script read from standard input loses its backquotes | — | +| builtins, control | `echo -n` prints `-n` as text | `-n` is unspecified but universal | +| heredoc | an unterminated here-document at end of file is an error | dash ends it silently, bash warns | +| arith, arith-edge | `9223372036854775807 + 1` is a fatal error | overflow is undefined; zash wraps | +| edge, expand-edge | quotes inside `${y:-"q r"}` stay literal; unquoted `$@` keeps empty fields | the dash meaning is the usual one | +| split | a trailing `IFS` delimiter makes an empty last field | both families drop it | +| cmdsub | `: $(exit 7)` is 7 | `:` succeeds, so 0 | +| errexit, errexit-edge | `set -e` reaches into `&&` lists and subshells | it does not | +| traps | a subshell survives `kill -INT $$`; the script runs on with status 0 instead of dying at 130 | zash and dash die, like the shell itself would | +| misc | `echo ~` with `HOME` unset stays `~` | unspecified; ash prints nothing | +| misc-builtins | `type nosuch` is status 1 and says `not a shell builtin` | a status over 0; zash says 127, like bash | +| params, read-edge, redir, redir-edge, vars | every failure is status 1 | the ash family uses 2 for redirection and assignment errors ([Deliberate differences](../DESIGN.md#deliberate-differences-from-other-shells)) | +| printf-ext | bytes 193-194 where zash prints 65-66 | the IBM sh is EBCDIC on that path | + +The `params, read-edge, redir, redir-edge, vars` row is the only one +where the choice is ours rather than IBM's: zash follows the ash family, +as `DESIGN.md` says it would, so a script written for ksh on z/OS that +tests `$?` against 1 will see 2 for a failed redirection. z/OS, ASCII build, `-m64`, 200 starts: |
