diff --git a/CHANGELOG.md b/CHANGELOG.md index eb81c68..c42ade8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,82 @@ +## 0.12.0 (2026-11-19) + +### Features + +- `syslog`: `Identity` names the program and the structured-data identifier of an event; `formatRfc5424For`, `formatJournaldFor` and `emitFor` take one, and `send` delivers an already formatted payload, for a tool with formatting of its own. The functions without an identity keep writing `eb-keep-logs`, as 0.11.0 did, and are removed in 0.13.0. + +### Miscellaneous + +- Prepare `zig-common` `0.12.0` in `COMPAT.md` for callers adopting `syslog.Identity` and `syslog.send`. + + +## 0.11.0 (2026-11-19) + +### Features + +- Add `pytext.osError` and `pytext.osErrorErrno` for Python-formatted `OSError` path messages. +- Add `pytext.reprStr` and `pytext.reprStrAlloc` for Python-compatible surrogateescape string quoting. +- Add `state.lockExclusiveCancel` supporting atomic cancellation while polling `flock`. +- Add `sys.strerror` returning `errnoText(e)` or the enum tag name fallback. +- `json.writeCacheStringTo` writes cache-style JSON strings to a writer without allocation. +- `proc.resolveExecutable` resolves executable names to absolute executable regular-file paths from slash paths or PATH lookup with a null-PATH default of `/bin:/usr/bin`. +- `proc.whichShutil` adds an opt-in executable lookup mode that matches POSIX `shutil.which` behavior. +- `syslog`: the RFC 5424 and systemd-journald event emitter that eb-keep-logs and eessi-arch-guard each carried a copy of: `Target`, `parseTarget`, `parsePen`, `formatRfc5424`, `formatJournald` and `emit`. + +### Fixes + +- Decode UTF-8 keys, UTF-16 surrogate pairs, and surrogateescape cache bytes in `json.Value.get` so escaped non-ASCII keys match like `json.loads`. +- Fix `sys.strerror` to avoid panicking on unnamed `linux.E` values by using `std.enums.tagName` with an `"Unknown error N"` fallback. +- `fsx.appendLine` reports `not a regular file` for an existing non-regular target such as a FIFO. +- `fsx.moveAcross` reports `error.NotRegularFile` when EXDEV fallback copies a tree entry that none of the earlier copy branches handle. +- `fsx.moveAcross` reports `not a regular file` for a FIFO source that takes the EXDEV copy fallback. +- `fsx.openRegular` now reports `error.NotRegularFile` for FIFOs, sockets, and device nodes, and `sys.describe` renders that as `not a regular file` instead of `[Errno 22] Invalid argument`. +- `fsx.openRegular` now returns `error.IsDir` for directory paths, so `sys.describe` reports `[Errno 21] Is a directory` instead of `[Errno 22] Invalid argument` for that case. + +### Documentation + +- List every public function and error set including PR #24 shared helpers in `docs/orgmode/reference/api.org`. + +### Miscellaneous + +- Add `atomic.Ops` fault hooks and unit tests covering `atomicWrite` failures on `ENOSPC`, `EROFS`, and `EXDEV`, as well as `makedirs` and `fsyncDir` error paths. +- Add unit tests covering `gzipInPlace` error paths (missing file, directory, symlink, hard link, and existing `.gz` archive) in `src/logs.zig`. +- Add unit tests covering `sys.errnoText` for unknown errno values and error paths for `sys` syscall wrappers. +- Add unit tests covering error and boundary paths for `which`, `groupAlive`, `killGroup`, `stopGroup`, and `run` in `src/proc.zig`. +- Add unit tests covering error paths for public file and directory helpers in `src/fsx.zig`. +- Add unit tests verifying `cli.put` and `cli.print` ignore descriptor write errors and checking `cli.versionLine` formatting. +- Prepare `zig-common` `0.11.0` in `COMPAT.md` for callers adopting `syslog`. A release is now `cog bump` on a release branch: `cog.toml` sets the version in `build.zig.zon` and refuses a version without a `COMPAT.md` row. +- Proc resolver tests share one executable fixture helper for scratch script and plain file setup. +- Route `lockExclusiveCancel` through `state.lock_ops.flock` and add unit tests covering `lockExclusive` with timeout 0, bounded timeout, unsupported `flock`, and private state file error paths. +- The private `proc.isExecutableFile` helper holds the executable regular-file probe that `proc.which` runs for each PATH candidate. +- `json.writeWireString` writes each string through one writer and the shared escape code. +- `proc.resolveExecutable` tests cover relative slash paths for executable and non-executable files. +- `proc.which` tests cover executable resolution and null returns for non-executable candidates. +- `proc.which` uses one internal options-driven search loop for executable path matching. +- `proc` test fixtures clean up scratch directories when setup fails after partial creation. + + +## 0.10.0 (2026-11-18) + +### Features + +- Add `fsx.mkdtemp` to create a private `0700` directory with a random suffix under a given parent directory and retry on name collisions. +- Add `fsx.normPath` and `fsx.absPath` to normalize and absolutize POSIX paths without following symbolic links. +- `fsx.moveAcross` adds a durable cross-filesystem move primitive: it tries `rename` first, falls back on EXDEV to a destination-side temporary copy, publishes with an atomic rename, and removes the source only after publish. The new `fsx.MoveAcrossOptions` policy is opt-in, with `strict` for ACL-preserving copies and `portable` for ACL downgrade when destination filesystems do not represent the source ACL form. + +### Documentation + +- Every `pub` declaration has a doc comment, whose first sentence is the summary the API pages list. +- The documentation site is built from Org pages in `docs/orgmode/` with Sphinx, in four parts: the tutorial "Write a small tool on zig-common", how-to guides, explanation and reference. Each module's API page is generated from its doc comments, and the site publishes an `objects.inv` of every `pub` declaration for the tools' sites to link into. `pixi run -e docs docbld` builds it as CI does and fails on a warning, an unresolved name or a dead internal link; `pixi run -e docs linkcheck` checks the external links. The `docs` workflow publishes the site to GitHub Pages; `docs/requirements.txt` and `pages.yml` are gone. +- The site has how-to guides for replacing a file and keeping its access control lists, keeping private state in `/tmp`, compressing logs that `.licensed-logs` marks, matching a Python tool's output and upgrading zig-common; explanations of process groups and deadlines, system calls without a C library, and Python compatibility; and a reference of the messages, exit statuses and version line that `cli` gives the tools. + +### Miscellaneous + +- Prepare `zig-common` `0.10.0` in `build.zig.zon` and `COMPAT.md` for callers adopting `fsx.mkdtemp` plus `fsx.normPath` and `fsx.absPath`. + + ## 0.9.0 (2026-11-16) ### Features diff --git a/changelog.d/+append-line-fifo-text.bugfix.md b/changelog.d/+append-line-fifo-text.bugfix.md deleted file mode 100644 index 7196917..0000000 --- a/changelog.d/+append-line-fifo-text.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`fsx.appendLine` reports `not a regular file` for an existing non-regular target such as a FIFO. diff --git a/changelog.d/+atomic-write-error-tests.misc.md b/changelog.d/+atomic-write-error-tests.misc.md deleted file mode 100644 index a163b29..0000000 --- a/changelog.d/+atomic-write-error-tests.misc.md +++ /dev/null @@ -1 +0,0 @@ -Add `atomic.Ops` fault hooks and unit tests covering `atomicWrite` failures on `ENOSPC`, `EROFS`, and `EXDEV`, as well as `makedirs` and `fsyncDir` error paths. diff --git a/changelog.d/+cli-write-errors-test.misc.md b/changelog.d/+cli-write-errors-test.misc.md deleted file mode 100644 index 7759594..0000000 --- a/changelog.d/+cli-write-errors-test.misc.md +++ /dev/null @@ -1 +0,0 @@ -Add unit tests verifying `cli.put` and `cli.print` ignore descriptor write errors and checking `cli.versionLine` formatting. diff --git a/changelog.d/+doc-comments.doc.md b/changelog.d/+doc-comments.doc.md deleted file mode 100644 index 4636ddf..0000000 --- a/changelog.d/+doc-comments.doc.md +++ /dev/null @@ -1 +0,0 @@ -Every `pub` declaration has a doc comment, whose first sentence is the summary the API pages list. diff --git a/changelog.d/+docs-pages.doc.md b/changelog.d/+docs-pages.doc.md deleted file mode 100644 index 987695c..0000000 --- a/changelog.d/+docs-pages.doc.md +++ /dev/null @@ -1 +0,0 @@ -The site has how-to guides for replacing a file and keeping its access control lists, keeping private state in `/tmp`, compressing logs that `.licensed-logs` marks, matching a Python tool's output and upgrading zig-common; explanations of process groups and deadlines, system calls without a C library, and Python compatibility; and a reference of the messages, exit statuses and version line that `cli` gives the tools. diff --git a/changelog.d/+docs-site.doc.md b/changelog.d/+docs-site.doc.md deleted file mode 100644 index 9c048c0..0000000 --- a/changelog.d/+docs-site.doc.md +++ /dev/null @@ -1 +0,0 @@ -The documentation site is built from Org pages in `docs/orgmode/` with Sphinx, in four parts: the tutorial "Write a small tool on zig-common", how-to guides, explanation and reference. Each module's API page is generated from its doc comments, and the site publishes an `objects.inv` of every `pub` declaration for the tools' sites to link into. `pixi run -e docs docbld` builds it as CI does and fails on a warning, an unresolved name or a dead internal link; `pixi run -e docs linkcheck` checks the external links. The `docs` workflow publishes the site to GitHub Pages; `docs/requirements.txt` and `pages.yml` are gone. diff --git a/changelog.d/+fsx-error-paths-test.misc.md b/changelog.d/+fsx-error-paths-test.misc.md deleted file mode 100644 index 2a927cf..0000000 --- a/changelog.d/+fsx-error-paths-test.misc.md +++ /dev/null @@ -1 +0,0 @@ -Add unit tests covering error paths for public file and directory helpers in `src/fsx.zig`. diff --git a/changelog.d/+fsx-mkdtemp.feature.md b/changelog.d/+fsx-mkdtemp.feature.md deleted file mode 100644 index bd11c7e..0000000 --- a/changelog.d/+fsx-mkdtemp.feature.md +++ /dev/null @@ -1 +0,0 @@ -Add `fsx.mkdtemp` to create a private `0700` directory with a random suffix under a given parent directory and retry on name collisions. diff --git a/changelog.d/+fsx-normpath.feature.md b/changelog.d/+fsx-normpath.feature.md deleted file mode 100644 index 76e0848..0000000 --- a/changelog.d/+fsx-normpath.feature.md +++ /dev/null @@ -1 +0,0 @@ -Add `fsx.normPath` and `fsx.absPath` to normalize and absolutize POSIX paths without following symbolic links. diff --git a/changelog.d/+json-value-get-utf8.bugfix.md b/changelog.d/+json-value-get-utf8.bugfix.md deleted file mode 100644 index 4b41829..0000000 --- a/changelog.d/+json-value-get-utf8.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -Decode UTF-8 keys, UTF-16 surrogate pairs, and surrogateescape cache bytes in `json.Value.get` so escaped non-ASCII keys match like `json.loads`. diff --git a/changelog.d/+json-write-cache-string-to.feature.md b/changelog.d/+json-write-cache-string-to.feature.md deleted file mode 100644 index 3d3f8be..0000000 --- a/changelog.d/+json-write-cache-string-to.feature.md +++ /dev/null @@ -1 +0,0 @@ -`json.writeCacheStringTo` writes cache-style JSON strings to a writer without allocation. diff --git a/changelog.d/+json-write-wire-shared-writer.misc.md b/changelog.d/+json-write-wire-shared-writer.misc.md deleted file mode 100644 index a9e9250..0000000 --- a/changelog.d/+json-write-wire-shared-writer.misc.md +++ /dev/null @@ -1 +0,0 @@ -`json.writeWireString` writes each string through one writer and the shared escape code. diff --git a/changelog.d/+logs-error-tests.misc.md b/changelog.d/+logs-error-tests.misc.md deleted file mode 100644 index eb25516..0000000 --- a/changelog.d/+logs-error-tests.misc.md +++ /dev/null @@ -1 +0,0 @@ -Add unit tests covering `gzipInPlace` error paths (missing file, directory, symlink, hard link, and existing `.gz` archive) in `src/logs.zig`. diff --git a/changelog.d/+move-across-fifo-source-text.bugfix.md b/changelog.d/+move-across-fifo-source-text.bugfix.md deleted file mode 100644 index 0d29ba3..0000000 --- a/changelog.d/+move-across-fifo-source-text.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`fsx.moveAcross` reports `not a regular file` for a FIFO source that takes the EXDEV copy fallback. diff --git a/changelog.d/+move-across.feature.md b/changelog.d/+move-across.feature.md deleted file mode 100644 index c49aff8..0000000 --- a/changelog.d/+move-across.feature.md +++ /dev/null @@ -1 +0,0 @@ -`fsx.moveAcross` adds a durable cross-filesystem move primitive: it tries `rename` first, falls back on EXDEV to a destination-side temporary copy, publishes with an atomic rename, and removes the source only after publish. The new `fsx.MoveAcrossOptions` policy is opt-in, with `strict` for ACL-preserving copies and `portable` for ACL downgrade when destination filesystems do not represent the source ACL form. diff --git a/changelog.d/+move-tree-special-entry-diagnostic.bugfix.md b/changelog.d/+move-tree-special-entry-diagnostic.bugfix.md deleted file mode 100644 index fd34662..0000000 --- a/changelog.d/+move-tree-special-entry-diagnostic.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`fsx.moveAcross` reports `error.NotRegularFile` when EXDEV fallback copies a tree entry that none of the earlier copy branches handle. diff --git a/changelog.d/+open-regular-dir-errno.bugfix.md b/changelog.d/+open-regular-dir-errno.bugfix.md deleted file mode 100644 index 2e9ab40..0000000 --- a/changelog.d/+open-regular-dir-errno.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`fsx.openRegular` now returns `error.IsDir` for directory paths, so `sys.describe` reports `[Errno 21] Is a directory` instead of `[Errno 22] Invalid argument` for that case. diff --git a/changelog.d/+open-regular-special-files-text.bugfix.md b/changelog.d/+open-regular-special-files-text.bugfix.md deleted file mode 100644 index 4f66d34..0000000 --- a/changelog.d/+open-regular-special-files-text.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`fsx.openRegular` now reports `error.NotRegularFile` for FIFOs, sockets, and device nodes, and `sys.describe` renders that as `not a regular file` instead of `[Errno 22] Invalid argument`. diff --git a/changelog.d/+proc-error-tests.misc.md b/changelog.d/+proc-error-tests.misc.md deleted file mode 100644 index 67ad9a9..0000000 --- a/changelog.d/+proc-error-tests.misc.md +++ /dev/null @@ -1 +0,0 @@ -Add unit tests covering error and boundary paths for `which`, `groupAlive`, `killGroup`, `stopGroup`, and `run` in `src/proc.zig`. diff --git a/changelog.d/+proc-executable-file-check.misc.md b/changelog.d/+proc-executable-file-check.misc.md deleted file mode 100644 index 277303b..0000000 --- a/changelog.d/+proc-executable-file-check.misc.md +++ /dev/null @@ -1 +0,0 @@ -The private `proc.isExecutableFile` helper holds the executable regular-file probe that `proc.which` runs for each PATH candidate. diff --git a/changelog.d/+proc-executable-fixture-tests.misc.md b/changelog.d/+proc-executable-fixture-tests.misc.md deleted file mode 100644 index ae66a4d..0000000 --- a/changelog.d/+proc-executable-fixture-tests.misc.md +++ /dev/null @@ -1 +0,0 @@ -Proc resolver tests share one executable fixture helper for scratch script and plain file setup. diff --git a/changelog.d/+proc-fixture-failure-cleanup.misc.md b/changelog.d/+proc-fixture-failure-cleanup.misc.md deleted file mode 100644 index 527d5b6..0000000 --- a/changelog.d/+proc-fixture-failure-cleanup.misc.md +++ /dev/null @@ -1 +0,0 @@ -`proc` test fixtures clean up scratch directories when setup fails after partial creation. diff --git a/changelog.d/+proc-resolve-executable-relative-slash.misc.md b/changelog.d/+proc-resolve-executable-relative-slash.misc.md deleted file mode 100644 index c028154..0000000 --- a/changelog.d/+proc-resolve-executable-relative-slash.misc.md +++ /dev/null @@ -1 +0,0 @@ -`proc.resolveExecutable` tests cover relative slash paths for executable and non-executable files. diff --git a/changelog.d/+proc-resolve-executable.feature.md b/changelog.d/+proc-resolve-executable.feature.md deleted file mode 100644 index 7ce97a4..0000000 --- a/changelog.d/+proc-resolve-executable.feature.md +++ /dev/null @@ -1 +0,0 @@ -`proc.resolveExecutable` resolves executable names to absolute executable regular-file paths from slash paths or PATH lookup with a null-PATH default of `/bin:/usr/bin`. diff --git a/changelog.d/+proc-which-direct.misc.md b/changelog.d/+proc-which-direct.misc.md deleted file mode 100644 index 104037c..0000000 --- a/changelog.d/+proc-which-direct.misc.md +++ /dev/null @@ -1 +0,0 @@ -`proc.which` tests cover executable resolution and null returns for non-executable candidates. diff --git a/changelog.d/+proc-which-search-options.misc.md b/changelog.d/+proc-which-search-options.misc.md deleted file mode 100644 index 87540fc..0000000 --- a/changelog.d/+proc-which-search-options.misc.md +++ /dev/null @@ -1 +0,0 @@ -`proc.which` uses one internal options-driven search loop for executable path matching. diff --git a/changelog.d/+proc-which-shutil.feature.md b/changelog.d/+proc-which-shutil.feature.md deleted file mode 100644 index f4f6977..0000000 --- a/changelog.d/+proc-which-shutil.feature.md +++ /dev/null @@ -1 +0,0 @@ -`proc.whichShutil` adds an opt-in executable lookup mode that matches POSIX `shutil.which` behavior. diff --git a/changelog.d/+pytext-os-error.feature.md b/changelog.d/+pytext-os-error.feature.md deleted file mode 100644 index e55b842..0000000 --- a/changelog.d/+pytext-os-error.feature.md +++ /dev/null @@ -1 +0,0 @@ -Add `pytext.osError` and `pytext.osErrorErrno` for Python-formatted `OSError` path messages. diff --git a/changelog.d/+pytext-repr.feature.md b/changelog.d/+pytext-repr.feature.md deleted file mode 100644 index 25c625b..0000000 --- a/changelog.d/+pytext-repr.feature.md +++ /dev/null @@ -1 +0,0 @@ -Add `pytext.reprStr` and `pytext.reprStrAlloc` for Python-compatible surrogateescape string quoting. diff --git a/changelog.d/+reference-api-pr24.doc.md b/changelog.d/+reference-api-pr24.doc.md deleted file mode 100644 index a0b6038..0000000 --- a/changelog.d/+reference-api-pr24.doc.md +++ /dev/null @@ -1 +0,0 @@ -List every public function and error set including PR #24 shared helpers in `docs/orgmode/reference/api.org`. diff --git a/changelog.d/+release-0.10.0.misc.md b/changelog.d/+release-0.10.0.misc.md deleted file mode 100644 index d676173..0000000 --- a/changelog.d/+release-0.10.0.misc.md +++ /dev/null @@ -1 +0,0 @@ -Prepare `zig-common` `0.10.0` in `build.zig.zon` and `COMPAT.md` for callers adopting `fsx.mkdtemp` plus `fsx.normPath` and `fsx.absPath`. diff --git a/changelog.d/+release-0.11.0.misc.md b/changelog.d/+release-0.11.0.misc.md deleted file mode 100644 index 2f5905b..0000000 --- a/changelog.d/+release-0.11.0.misc.md +++ /dev/null @@ -1 +0,0 @@ -Prepare `zig-common` `0.11.0` in `COMPAT.md` for callers adopting `syslog`. A release is now `cog bump` on a release branch: `cog.toml` sets the version in `build.zig.zon` and refuses a version without a `COMPAT.md` row. diff --git a/changelog.d/+release-0.12.0.misc.md b/changelog.d/+release-0.12.0.misc.md deleted file mode 100644 index 529f264..0000000 --- a/changelog.d/+release-0.12.0.misc.md +++ /dev/null @@ -1 +0,0 @@ -Prepare `zig-common` `0.12.0` in `COMPAT.md` for callers adopting `syslog.Identity` and `syslog.send`. diff --git a/changelog.d/+state-lock-cancel.feature.md b/changelog.d/+state-lock-cancel.feature.md deleted file mode 100644 index c408c01..0000000 --- a/changelog.d/+state-lock-cancel.feature.md +++ /dev/null @@ -1 +0,0 @@ -Add `state.lockExclusiveCancel` supporting atomic cancellation while polling `flock`. diff --git a/changelog.d/+state-lock-exclusive-errors-test.misc.md b/changelog.d/+state-lock-exclusive-errors-test.misc.md deleted file mode 100644 index 1ab3440..0000000 --- a/changelog.d/+state-lock-exclusive-errors-test.misc.md +++ /dev/null @@ -1 +0,0 @@ -Route `lockExclusiveCancel` through `state.lock_ops.flock` and add unit tests covering `lockExclusive` with timeout 0, bounded timeout, unsupported `flock`, and private state file error paths. diff --git a/changelog.d/+sys-errnotext-unknown-test.misc.md b/changelog.d/+sys-errnotext-unknown-test.misc.md deleted file mode 100644 index 59f38a4..0000000 --- a/changelog.d/+sys-errnotext-unknown-test.misc.md +++ /dev/null @@ -1 +0,0 @@ -Add unit tests covering `sys.errnoText` for unknown errno values and error paths for `sys` syscall wrappers. diff --git a/changelog.d/+sys-strerror-unknown-panic.bugfix.md b/changelog.d/+sys-strerror-unknown-panic.bugfix.md deleted file mode 100644 index e0c47c7..0000000 --- a/changelog.d/+sys-strerror-unknown-panic.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -Fix `sys.strerror` to avoid panicking on unnamed `linux.E` values by using `std.enums.tagName` with an `"Unknown error N"` fallback. diff --git a/changelog.d/+sys-strerror.feature.md b/changelog.d/+sys-strerror.feature.md deleted file mode 100644 index 0e628e9..0000000 --- a/changelog.d/+sys-strerror.feature.md +++ /dev/null @@ -1 +0,0 @@ -Add `sys.strerror` returning `errnoText(e)` or the enum tag name fallback. diff --git a/changelog.d/+syslog-identity-and-send.feature.md b/changelog.d/+syslog-identity-and-send.feature.md deleted file mode 100644 index b362f19..0000000 --- a/changelog.d/+syslog-identity-and-send.feature.md +++ /dev/null @@ -1 +0,0 @@ -`syslog`: `Identity` names the program and the structured-data identifier of an event; `formatRfc5424For`, `formatJournaldFor` and `emitFor` take one, and `send` delivers an already formatted payload, for a tool with formatting of its own. The functions without an identity keep writing `eb-keep-logs`, as 0.11.0 did, and are removed in 0.13.0. diff --git a/changelog.d/+syslog.feature.md b/changelog.d/+syslog.feature.md deleted file mode 100644 index 6c4c620..0000000 --- a/changelog.d/+syslog.feature.md +++ /dev/null @@ -1 +0,0 @@ -`syslog`: the RFC 5424 and systemd-journald event emitter that eb-keep-logs and eessi-arch-guard each carried a copy of: `Target`, `parseTarget`, `parsePen`, `formatRfc5424`, `formatJournald` and `emit`.