| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
| |
buildenv
- Remove internal z/OS test-host name from notes/review-2026-11-27.md,
web/layouts/home.html, and tests/zos/zosvars.{sh,exp} (making zosvars
portable to any z/OS LPAR by comparing against live ZOS_SYSNAME).
- Add GitHub Actions CI status badge to README.md.
- Bump buildenv version to 0.5.0 with ZOPEN_STABLE_URL, ZOPEN_STABLE_TAG
(v0.5.0-beta), ZOPEN_DEV_URL, and explicit empty ZOPEN_RUNTIME_DEPS.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
- buildenv: declare coreutils, diffutils, and gzip in ZOPEN_DEV_DEPS and
ZOPEN_STABLE_DEPS (build/check deps only; no runtime deps added) so
tests/run.sh and tests/zos/tagging.sh have GNU tools and gzip under
zopen build's minimal check environment.
- tests/run.sh: unset _TAG_REDIR_IN, _TAG_REDIR_OUT, and _TAG_REDIR_ERR
alongside _BPX_SHAREAS/_BPX_SPAWN_SCRIPT so zopen's check_clang env
does not alter the tagging test baseline.
- tests/linux/i-dscomplete.exp: update expected listing for CSI_MAX_CALLS=3
(changed from 2 to 3 in b3879f5 without regenerating .exp).
- .github/workflows/ci.yml: add Linux CI workflow (Clang 19+, make,
make zos-lint, make check, make asan, staged make install).
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
- Add tests/zash/audit-fixes.{sh,exp} covering uppercase bases, closed-fd
duplication, [[ ... ]] and nested here-docs, quoted braces,
'for x; in', environment deduplication, PS4 expansion, pure subshell
write errors, pipeline unwind loop_depth, 'set +o', POSIX 1-4 arg test
rules, print -u bounds, whence -p, printf overflow and bare %b NULs,
time/select keywords, '--' handling, unalias -- -a, kill --, and read -t 0.
- Clear remaining clang-tidy warnings on changed lines in edit_builtin.c,
sys_posix.c, test.c, and var.c.
Verified on Linux (./zash and ./zash-asan); z/OS CBT verification next.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The 2026-11-28 review merge (#46) and the in-process `( cd dir )` merge
(#31) left four changes with no test of their own. Three of the eighteen
commits cannot have one, see below.
- tests/posix/glob-edge.sh: `deep/*` where `deep` holds a file, a
subdirectory, a symlink and a dangling symlink. This is the path the
glob change takes when the last component has no literal tail left:
it adds what readdir() named without an lstat(), so a directory and a
broken link must still appear. Replacing `sb_cstr(&g->path)` with the
unterminated buffer in that call makes this test fail.
- tests/posix/charset.sh: a reversed range `[z-a]` matches nothing,
which is what dash and bash do; the ASCII fast path compares bytes
where the EBCDIC path looks up a table, so the two must agree on the
edge.
- tests/posix/printf-ext.sh: a 5000-character `%s`. The bare `%s` fast
path writes the argument straight to the output instead of through
the format buffer, so length is now the output's business.
- tests/zash/heredoc-tmpdir.sh: a TMPDIR longer than PATH_MAX still
produces the here-document, through the pipe fallback.
- .exp files regenerated with dash (posix) and ./zash (zash), then
reviewed: only the added lines differ.
The three commits with no test:
- 270ac66 `signal()` to `sigaction()` for SIG_DFL: the disposition set is
the same, so no test can tell the two apart.
- 06e1dd5 the arena size guard: reaching it needs a SIZE_MAX/2
allocation.
- de0d26a the TMPDIR length check itself: a truncated temp name has no
`XXXXXX` left, so mkstemp() already failed and the pipe fallback
already ran. heredoc-tmpdir.sh pins that fallback, not the check.
Verified on Linux (7.3.4-300.fc45.x86_64, 2026-11-28): make check 128
passed, 1 skipped, the known linux/i-dscomplete failure; make asan the
same with no sanitizer report; the new posix tests pass against dash too.
|
| |\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
main gained an in-process `( cd dir )` of its own with the 2026-11-28
review merge (the uncommitted working tree the review was written
against, committed as cb1688f), so this branch and main both replaced
the fork for the same command, in two places.
That copy has a defect this branch guards against: with
readonly PWD; ( cd / ); echo after
the readonly assignment raises out of the saved-cwd block and kills the
whole shell - no `after` - where dash and bash both print it (dash rc=2,
bash rc=1). `subshell_in_process()` here refuses to run the `cd`
in-process unless PWD and OLDPWD are plain, and `builtin_cd_isolated()`
holds its own exception handler, so the fork still happens in that case.
Resolution: keep this branch's implementation and drop main's ad-hoc
branch in eval_subshell() together with the curdir_invalidate() helper
added for it, which had no other caller. The tests main brought with it
(tests/zash/subshell-cd.sh, tests/proc/subshell-pure.sh) still pass.
Verified on Linux (7.3.4-300.fc45.x86_64, 2026-11-28): make check 127
passed / 1 skipped / the known linux/i-dscomplete failure, make asan and
make valgrind the same, make mvs-asan 127 passed, make zos-lint clean,
the readonly-PWD case now matches dash. Not re-run on cbt.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`/` wrote the new pattern over the old one in ed.search and only wrote a
terminator when something had been typed. Type `ban` over `apple`, delete
the three letters, press Enter: the buffer still held "banle", so the
"empty pattern repeats the previous search" case searched a mix of the two
and found nothing (the terminal just beeped).
vi_read_pattern() collects the pattern in a local array and copies it into
ed.search only when it is non-empty; an empty pattern now really does leave
the previous one alone.
Test: tests/linux/i-vi.sh searches for apple, then types `ban` + three
backspaces + Enter, and expects `echo apple` back. Without the change the
line stays empty.
Verified on Linux with make check.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`v` and `fc -e` handed the editor "%s %s" of the editor and the mkstemp
file name, unquoted: with a TMPDIR holding a space or a `$` the editor saw
a path cut at the space, wrote nothing, and `fc` ran the original commands
again. The name now goes through out_quote() into an OUT_MEM buffer, so
the shell reads it back as one word; `sprintf` is gone.
Both commands also left the file behind when the editor command raised an
exception (a syntax error in $EDITOR, for one), because the raise jumps
past unlink(). They now catch it, unlink, and re-raise, the same way the
builtin wrapper in exec.c does.
fc_edit() also ignored a write error on the temporary file and went on to
run the editor; it now reports it and removes the file.
Test: tests/linux/i-fc-tmpdir.sh runs fc and `v` with TMPDIR="tmp dir$x"
through ptydrive, including a raising editor command, and then checks the
directory is empty. Without the change the editor is handed the broken
path and no file appears.
Verified on Linux with make check and the test under ASan+UBSan.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`"${@#ab}"` with `set -- abc abd` joined the parameters first
("abc abd"), trimmed the join, and emitted that as a single field
("c abd"). ksh93 and bash trim each parameter and then apply the "$@"
rules: two fields, "c" and "d".
expand_all_params() takes the pattern and the operator and trims every
parameter before emitting, so `"${@#pat}"` still gives one field each,
`"${*#pat}"` one field joined by IFS, and unquoted both split as before.
join_params_trimmed() is the join path, and trim() gets a forward
declaration because it sits further down the file.
Test: tests/zash/trim-all.sh, twelve lines covering all four operators,
@ and *, quoted and unquoted, empty parameters and a non-blank IFS. The
expected output is ksh93's and bash's, which agree line for line.
Verified on Linux with make check.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`ulimit -s 18014398509481984` (2^54 kbytes = 2^64 bytes) multiplied a
64-bit value by 1024 and wrapped to 0: the command succeeded and set the
stack limit to zero. It is now "limit out of range" and status 1, and so
is a value that would come out exactly RLIM_INFINITY without the user
writing "unlimited".
The `ulimit -a` label was copied into a 64-byte buffer for no reason;
"% -20s" gets the name straight from the table. And if a build has no
RLIMIT_FSIZE entry there is no default resource at all, so say that
instead of dereferencing a null pointer.
Test: tests/zash/ulimit.sh, in a subshell so a broken build cannot take
the test shell down with it. Verified on Linux: before the change the
command exits 0 and `ulimit -s` reports 0; after it, the warning and
status 1.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`y0` with the cursor at column 0 yanks an empty range, and the old code
then inserted the kill buffer at the cursor: with nothing killed yet that
was memcpy(dst, nullptr, 0), which UBSan rejects at src/edit_builtin.c:375;
with an earlier `cw` behind it, the old kill text was pasted into the
line (vi `y` changes nothing on the line).
The `y` case now copies the range into the kill buffer with kill_set() -
the same block remove_range() used - and puts the cursor at the start of
the range, which is where vi leaves it. insert() also returns early for
an empty string, so a later caller cannot repeat the null memcpy.
Test: tests/linux/i-vi.sh yanks an empty range after a `cw`, so the kill
buffer holds text that must not appear. Before the change UBSan reports
"null pointer passed as argument 2" and the line comes out as
"oneecho yank"; after it, the line is "echo yank".
Verified on Linux with make check and the same pty session under
ASan+UBSan.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`printf '%.*d' -5 1` built the conversion "%.-5jd" and printed it
literally: a width and precision taken with '*' were written with "%d"
of an (int) cast, so a negative precision produced ".-5" in the spec.
copy_number() now writes the value with "%jd" - no narrowing, which the
review asked for - and, for a precision, drops the '.' again when the
value is negative: C99 says a negative precision is as if it were
omitted. A negative width stays, where snprintf() reads the '-' as a
flag.
tests/posix/printf-ext.sh covers all four shapes; the expected output
is what dash and bash print.
Verified: make check, and the same test under ASan+UBSan on Linux.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`$((99999999999999999999#1))` multiplied its way through INT_MAX: UBSan
reports "signed integer overflow" at the base loop in parse_based(), and
in a release build the resulting base is whatever the wrap gave.
The base is now built with a bound (anything over 64 is "bad number
base" at once) and the digits are read by hand against ksh's digit set,
so `16#0x10`, `16# f`, `2#2` and `16#` stay errors instead of relying on
strtoumax()'s quirks. The digit set is a string looked up with strchr(),
not arithmetic on character codes: the letters are not contiguous in
EBCDIC, and the same source has to work on both sides.
That also makes bases 37 to 64 work, as they do in ksh:
`$((64#z))` is 35, `64#_` is 63, `64#@` is 62. Values still wrap at
UINTMAX_MAX, which is what the old code did for everything else, so a
literal that does not fit is still "bad number".
Verified: before the change, zash-asan reports src/arith.c:270 signed
integer overflow for the huge base and rejects 64#z; after it, the new
tests pass under ASan+UBSan on Linux. The EBCDIC build is untested here
(the mapping is a string constant, so it does not depend on the charset).
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`trap "echo ERR" ERR; /bin/false` printed nothing: the shell replaced
itself with the failing program and was gone before the trap could run.
The same shortcut made `trap ... ; (/bin/false)` silently skip it.
trap_after_last() is true when the EXIT or the ERR trap is set, and both
the exec shortcut in run_external() and the in-process subshell shortcut
in eval_subshell() now use it instead of trap_has_exit().
tests/zash/errtrap-exec.sh covers the external command, a builtin, a
subshell and the two traps together; the first and third lines fail
without the change. ksh93 prints ERR for all four.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A trap that fires while a command is half parsed, and vi's `v` command,
both run eval_string() from inside the outer parse. The nested
parse_command() points the static arena at its own arena, and freeing
that arena leaves the outer parse allocating from freed memory: silent
corruption in a release build, heap-use-after-free under ASan.
run_input() now brackets its whole body with parser_save()/parser_restore()
on every way out - the normal return, the error unwind and the EXIT
unwind of the recover loop - so any nested eval, present or future, is
safe. in_cond and alias_ended_blank join parser_state because a nested
parse changes them too; the static_assert keeps the snapshot buffer in
step.
Also move here_tail's doc comment back above here_tail.
Tests:
- tests/posix/trap-midtoken.sh: a trap delivered mid-token from a pipe.
It reports heap-use-after-free under `make asan` before the change and
passes after it.
- tests/linux/i-vi-edit.sh: `v` with $VISUAL, $EDITOR and a failing
editor through ptydrive; the edited line runs.
Verified on Linux (clang 20, -O3 -g) with `make check` and ASan+UBSan.
|
| | |
| |
| |
| |
| |
| |
| | |
The script gained the change/dot-repeat steps but the expected output
still stopped at 'echo done'. The ten lines it prints now are right:
0wx.. deletes three letters, 0dw. deletes two words, and after a motion
(l) the dot repeats the last change (x), not the motion.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The working tree the 2026-11-28 review was written against, committed
unchanged so the review fixes can sit on top of it.
- vi mode: `v` edits the line in $VISUAL, else $EDITOR (edit_external),
and `.` repeats the last change, count and all.
- `( cd dir )` runs in-process with the directory saved and restored,
instead of forking, and its invalidation of the cached logical cwd.
- tests/perf: a start-up cost guard; tests/run.sh runs that directory.
- README: set +o pipetag for ASCII builds.
- formal/zash-spec.txt regenerated as text.
- .clang-tidy: two checks re-enabled (no findings after the change).
- tests/scripts/webdocs: a `#` inside a fenced block is not a title.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
IBM's /bin/sh is of the KornShell line and `select` is part of what its
scripts use, so the shell that replaces it has to have it. The menu goes
to stderr as "number TAB word", then PS3 (default "#? "); the answer is
read with the rules of `read REPLY`; a number in range picks that word,
anything else leaves the variable empty and the body still runs, a blank
line only prompts again, and end of input ends the loop.
The node is the `for` node with a `menu` flag, since the two differ only
in what the body sees. tests/zash/select.sh prints the same bytes under
zash and under the CBT /bin/sh; the specification has the rule.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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)).
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The host was verified with IBM make and IBM Open XL, in a copy of the tree
(`tar`, extract, `chtag -R -t -c ISO8859-1 .`, `/bin/make zos-check`):
plain `make` still dispatches to zos-ascii, both binaries build without a
warning, the ASCII suite is 112 passed / 6 skipped / 0 failed, and the
EBCDIC subset passes.
Two expectations cannot be the same on both hosts, so zash/script-errors
keeps the POSIX cases and is skipped on z/OS (a mode 000 script still runs
there, because bit mode does not decide access), and tests/zos/
script-errors records the z/OS side. notes/review-2026-11-27.md now has a
per-item status table, the investigation results and the z/OS run.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Notes in notes/review-2026-11-27.md, one item per finding:
1. error unwinding read dead stack frames: the scope/redirection/input
snapshot now lives in jmploc and is restored before the longjmp
2. `for` without `in` iterated over parameters that `set --` could free:
the parameter block is reference-counted
3. `${4294967295}` and `${99999999999999999999}` indexed past the end:
strtol, clamped to 1..$#
4. a trap stopped running after its own action raised: the re-entry flag
is cleared before the action runs
5. `wait $pid` returned 127 once the job had been reaped
6. every external command failed with 127 when SIGCHLD was ignored at
startup: dispositions are reset before the first child
7. a failed `exec` killed an interactive shell and skipped its EXIT trap:
the shell returns 126/127, keeping the traps and restoring fds 0-9
8. `set -C` opened with O_TRUNC after a stat: O_EXCL, with the
non-regular-file case worked around
9. a here-doc cut off by EOF used the delimiter as its body
10. `cd -- dir` failed and PWD came from the failed logical path
11. deep arithmetic recursion overflowed the stack: a depth check
12. the CSI type byte was converted twice on EBCDIC: guarded by ZASH_ASCII
13. a script that could not be read looked like an empty script: reported,
with 2 at top level and 126/127 for the script; a directory is refused
up front, because z/OS would otherwise read it as empty input
Minors: `trap -p SIG`, `read -t` clamping and NaN, ksh `base#n` arithmetic,
`${#@}`/`${#*}` as `$#`, `jobs` no longer mutating its table from a
pipeline, the arena_grow contract, no pipe2 on macOS, and alias text copied
into the input so redefining an alias while it is being read is safe.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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).
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |/
|
|
|
|
|
| |
A subshell whose body is a single cd now runs in the parent shell with
the directory, PWD, OLDPWD and curdir saved and restored, instead of
forking. On z/OS a fork costs ~0.4 ms there; the cd itself costs ~5 us.
A readonly, integer or dynamic PWD/OLDPWD keeps the forked path.
|
| | |
|
| |
|
|
|
|
|
|
|
| |
* notes: plainer wording in the 64-bit start-up write-up
Same findings, less staging: no dash-as-connector, no bold cell, no
"not X but Y" contrast, and one space after a full stop like the rest
of the file. Also fixes "4-5 orders of magnitude" for a 5x difference.
* tests: clang-format spawn.c
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
| |\
| |
| | |
bench: measure start-up wall time against the other shells
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
| |
| |
| |
| |
| |
| |
| | |
A child inherits _CEE_DMPTARG and writes its own heap report, so the
substitution and the pipeline added a report per iteration: growth
measured 2 MB over 900 children, none of it zash's. The forked
commands now turn heap checking off for themselves, and the test fails
if anything but one report came back.
|
| | |
| |
| |
| |
| |
| |
| | |
The loop body had builtins only, so nothing but parsing, expansion and
variables was measured. A substitution, a redirection, a forked
command and a pipeline per iteration put the storage those paths keep
under the same comparison.
|
| |\|
| |
| | |
test: fail when zash leaks under LE's heap checker
|
| | |
| |
| |
| |
| |
| |
| |
| | |
The growth over 10x the work is 0 or 8 bytes depending on how the
environment copy lands on an 8-byte boundary, so printing it made the
expectation depend on the caller's environment. Print the finding only
when the limit is exceeded; the reports in build/leaks keep the
numbers.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | | |
|
| |/ |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
"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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
| |
/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.
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
| |
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.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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|