<feed xmlns='http://www.w3.org/2005/Atom'>
<title>zash.git/tests/linux, branch v0.5.0-beta</title>
<subtitle>Fast Almquist-family POSIX shell for z/OS UNIX with bundled libedit</subtitle>
<id>https://git.abendless.com/zash.git/atom?h=v0.5.0-beta</id>
<link rel='self' href='https://git.abendless.com/zash.git/atom?h=v0.5.0-beta'/>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/'/>
<updated>2026-11-29T16:20:40Z</updated>
<entry>
<title>Fix zopen packaging checks, update i-dscomplete.exp, and add GitHub Actions CI</title>
<updated>2026-11-29T16:20:40Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-29T16:20:40Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=c395bd53d22de9fcda6bfec25596223845e83a22'/>
<id>urn:sha1:c395bd53d22de9fcda6bfec25596223845e83a22</id>
<content type='text'>
- 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).
</content>
</entry>
<entry>
<title>fix(edit): vi search reads its pattern into a buffer of its own</title>
<updated>2026-11-28T06:39:28Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-28T06:39:28Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=95bf87d4ed037e6d6786cc395d94dbe44ee88e32'/>
<id>urn:sha1:95bf87d4ed037e6d6786cc395d94dbe44ee88e32</id>
<content type='text'>
`/` 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.
</content>
</entry>
<entry>
<title>fix(edit): quote the temporary file name for the editor</title>
<updated>2026-11-28T06:37:39Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-28T06:37:39Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=d538cc8ce9c32c932e12134b7bd59a88e88d748c'/>
<id>urn:sha1:d538cc8ce9c32c932e12134b7bd59a88e88d748c</id>
<content type='text'>
`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.
</content>
</entry>
<entry>
<title>fix(edit): vi `y` keeps the line and never pastes the old kill</title>
<updated>2026-11-28T06:30:30Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-28T06:30:30Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=56bd0e6c2ab87ab140cef35882cff52153f36b7c'/>
<id>urn:sha1:56bd0e6c2ab87ab140cef35882cff52153f36b7c</id>
<content type='text'>
`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.
</content>
</entry>
<entry>
<title>fix(parser): save and restore the parser state in run_input</title>
<updated>2026-11-28T06:13:39Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-28T06:13:39Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=0fc285274b7dacbba311bdbd4b4697b7ebcac09c'/>
<id>urn:sha1:0fc285274b7dacbba311bdbd4b4697b7ebcac09c</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>tests: regenerate i-vi.exp for the change and dot-repeat steps</title>
<updated>2026-11-28T06:12:03Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-28T06:12:03Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=8ac2777c82668c46c24bb0f3047c1128f9553760'/>
<id>urn:sha1:8ac2777c82668c46c24bb0f3047c1128f9553760</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>wip: vi external edit and dot-repeat, in-process cd subshell, perf test</title>
<updated>2026-11-28T06:08:16Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-28T06:07:39Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=cb1688f0233d53cfca8078f812c824213a5617fd'/>
<id>urn:sha1:cb1688f0233d53cfca8078f812c824213a5617fd</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>fix: the review findings, each with a regression test</title>
<updated>2026-11-27T23:26:45Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-27T23:26:45Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=90e25207c41010a5307beff7fd7a5a9e4be3653e'/>
<id>urn:sha1:90e25207c41010a5307beff7fd7a5a9e4be3653e</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>interactive: one editor, no library</title>
<updated>2026-11-26T03:54:08Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-26T03:54:08Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=87c6a0f8f822c57b4f63bc8bb099a33307871414'/>
<id>urn:sha1:87c6a0f8f822c57b4f63bc8bb099a33307871414</id>
<content type='text'>
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).
</content>
</entry>
<entry>
<title>interactive: completion works in the libedit build too</title>
<updated>2026-11-26T03:44:25Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-26T03:44:25Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=5364f98dff13a4bc9202a14bc5f9146436366039'/>
<id>urn:sha1:5364f98dff13a4bc9202a14bc5f9146436366039</id>
<content type='text'>
The libedit editor had no Tab binding at all, so the same line typed in
the two builds behaved differently: `myalias&lt;Tab&gt;` 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.
</content>
</entry>
</feed>
