<feed xmlns='http://www.w3.org/2005/Atom'>
<title>zash.git/tests/posix, branch main</title>
<subtitle>Fast Almquist-family POSIX shell for z/OS UNIX with bundled libedit</subtitle>
<id>https://git.abendless.com/zash.git/atom?h=main</id>
<link rel='self' href='https://git.abendless.com/zash.git/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/'/>
<updated>2026-11-28T22:34:52Z</updated>
<entry>
<title>tests: cover the review fixes that landed without one</title>
<updated>2026-11-28T22:34:52Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-28T22:34:52Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=648125a5ef1a98519c5d2cd66c4f015bcb8b5b1f'/>
<id>urn:sha1:648125a5ef1a98519c5d2cd66c4f015bcb8b5b1f</id>
<content type='text'>
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(&amp;g-&gt;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.
</content>
</entry>
<entry>
<title>fix(printf): a negative '*' precision is no precision</title>
<updated>2026-11-28T06:26:01Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-28T06:26:01Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=a5a920383fe85f4dada0cb80418f7a935c12dc4a'/>
<id>urn:sha1:a5a920383fe85f4dada0cb80418f7a935c12dc4a</id>
<content type='text'>
`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.
</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>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>test: check the PATH suffix without a line-length-limited grep</title>
<updated>2026-11-24T05:11:00Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-24T05:11:00Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=9c6a6e62896cf4f011a0203482615c51fc23a569'/>
<id>urn:sha1:9c6a6e62896cf4f011a0203482615c51fc23a569</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fix: make zopen checks run in the foreground and tolerate a long CFLAGS</title>
<updated>2026-11-24T05:09:23Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-24T05:09:23Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=4ba0f0eebc68a79ed038b1531bae2b1539b79c9b'/>
<id>urn:sha1:4ba0f0eebc68a79ed038b1531bae2b1539b79c9b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>chore: clangd sysroot note, shellcheck header, typst formatting</title>
<updated>2026-11-23T20:38:19Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-23T20:38:19Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=bb1245976f10806634d2a60edd6218ecc23c8894'/>
<id>urn:sha1:bb1245976f10806634d2a60edd6218ecc23c8894</id>
<content type='text'>
</content>
</entry>
<entry>
<title>z/OS: run 31-bit and load IGGCSI00 through the C library</title>
<updated>2026-11-23T17:09:32Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-23T17:09:32Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=d1ea4c7f4530e3d1d4689a9d20029a0c1a418df5'/>
<id>urn:sha1:d1ea4c7f4530e3d1d4689a9d20029a0c1a418df5</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>tests/posix/test-ops: do not expect -s to be true for a directory</title>
<updated>2026-11-18T14:08:24Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-18T14:08:24Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=0be301b26cd8fdfe7013c78b49ca54477530e917'/>
<id>urn:sha1:0be301b26cd8fdfe7013c78b49ca54477530e917</id>
<content type='text'>
z/OS reports a directory size of 0 and POSIX lets a system choose it, so
one line of the loop depended on the platform's stat().
</content>
</entry>
<entry>
<title>z/OS ASCII build: IBM-1047 on pipes, here-docs, redirects, std streams; fdmap test independent of /bin/sh</title>
<updated>2026-11-18T01:46:01Z</updated>
<author>
<name>Sean Kurtz</name>
<email>seankurtz75@gmail.com</email>
</author>
<published>2026-11-18T01:46:01Z</published>
<link rel='alternate' type='text/html' href='https://git.abendless.com/zash.git/commit/?id=870ad71182b7cf1772387c3a4ba1894805018574'/>
<id>urn:sha1:870ad71182b7cf1772387c3a4ba1894805018574</id>
<content type='text'>
</content>
</entry>
</feed>
