Skip to content

feat: type/which/declare/ln builtins, errexit, nounset fix, sort -z, cut -z#233

Merged
chaliy merged 3 commits intomainfrom
claude/bashkit-bash-compatibility-BsDKD
Feb 23, 2026
Merged

feat: type/which/declare/ln builtins, errexit, nounset fix, sort -z, cut -z#233
chaliy merged 3 commits intomainfrom
claude/bashkit-bash-compatibility-BsDKD

Conversation

@chaliy
Copy link
Contributor

@chaliy chaliy commented Feb 23, 2026

Summary

  • New builtins: type (with -t/-a/-p/-f/-P), which, hash (no-op), declare/typeset (with -p/-r/-x/-a/-i), ln (with -s/-f)
  • Fix errexit (set -e): Top-level execute loop now checks errexit; fixed ! pipeline negation parsing (was never parsed)
  • Fix nounset (set -u): ${var:-default} and similar expansions no longer trigger unbound variable error
  • Add sort -z / cut -z: Zero-terminated input/output support; also fixed \0 escape in tr's expand_char_set

Test plan

  • 15 new tests in type.test.sh (type/which/hash with flags)
  • 10 new tests in declare.test.sh (declare/typeset with flags)
  • 5 new tests in ln.test.sh (symlink creation, force, errors)
  • Removed skip markers from nounset_default_value_ok, neg_errexit_stops, sort_zero_terminated, cut_zero_terminated
  • cargo test --all-features passes
  • cargo clippy --all-targets --all-features -- -D warnings clean
  • Updated specs/009-implementation-status.md

…cut -z

- Add type builtin with -t, -a, -p flags for command type inspection
- Add which builtin for command location
- Add hash builtin (no-op in sandboxed environment)
- Add declare/typeset builtin with -i, -r, -x, -a, -p flags
- Add ln builtin for symbolic link creation (-s, -f)
- Fix ! pipeline negation in parser (was never parsed)
- Fix set -e (errexit) at top-level script execution
- Fix ${var:-default} under set -u (nounset) to not error
- Add nounset awareness to all parameter expansion operators
- Add sort -z (zero-terminated input/output)
- Add cut -z (zero-terminated input/output)
- Add tr \0 escape sequence support
- 30 new spec tests, 4 previously-skipped tests now passing
- Update 009-implementation-status.md (90 core + 3 gated = 93 builtins)

https://claude.ai/code/session_012rzB3FRw7yoQWCG1mxyW7J
type/which/hash/ln tests that differ from real bash due to sandboxed
environment (no PATH, no process table, VFS-only symlinks).
@chaliy chaliy merged commit aa32ab9 into main Feb 23, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants