diff --git a/CHANGELOG.md b/CHANGELOG.md index 9055909..eb81c68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,49 @@ +## 0.9.0 (2026-11-16) + +### Features + +- `proc.killGroup(pgid, sig)` sends a signal to the process group that `Options.pgid_out` published, or to the child itself while it has not made that group yet, as `proc.run` does. It makes only kill system calls and does not wait, so a signal handler can call it; `proc.stopGroup` also waits for the group to go. + +### Fixes + +- A refused gate is the new `RootLock.AcquireError.GateNotPrivate` (`NotPrivate` stays the sidecar's), a symbolic link as the state root is `NotDir`, and `LockOps.open_sidecar` takes the state root's descriptor and a name. +- `atomic.atomicWrite` frees everything it allocates from the caller's allocator before it returns (the temporary path, the step names, the ACLs it reads and the refusals it wraps), which only an arena used to hide. A refusal's `why.msg` is the caller's, freed by the new `Why.deinit`; the ACLs `readAcls` and `readMetadata` return are freed by the new `Acls.deinit` and `Metadata.deinit`. +- `atomicWrite` frees the path, the step names and the spare ACL read it allocates. +- `atomic` retries an ACL read interrupted by a signal, instead of refusing the replacement. +- `atomic` words a failed ACL read with `sys.describeErrno`, glibc's text for every errno Linux names (`[Errno 116] Stale file handle`), instead of its own six-entry table that printed the errno's name for the rest. +- `fsx.appendLine` rolls a short write back, so a full disk does not leave a partial line. +- `fsx.copyTo` copies the whole source, whatever the descriptor's offset, and leaves the offset where it was, as its doc says; it copied from the offset to the end and left the offset there. +- `fsx.copyTo` renames the new bytes into place, so a short write leaves the existing file unchanged. +- `fsx.replaceContents` copies a GPFS native NFSv4 ACL (`system.gpfs_nfs4_acl`), which it dropped, and, as `atomic` does, copies only the most native ACL form the old file has. GPFS's EINVAL for an NFSv4 form of a file with a POSIX ACL no longer fails the replacement. `fsx.acl_attributes` is the one list of forms, and `atomic` uses it. +- `json.decodeCache` and `json.decodeWire` return `error.Encoding` for an escape that is cut off, unknown or a `\u` without four hex digits, where they read past the string or took `\u+123` and `\x0041`; what they allocated before the error is freed. `Value.get` does not read past a key that ends in a backslash. +- `json.parse` refuses arrays and objects nested more than 32 deep, now `json.max_depth`, whether or not the innermost one is empty; 33 nested empty containers used to parse. The limit is documented, and the module summary covers the parser, both codecs, `toPy` and `dumps`. +- `json.toPy` returns `error.Encoding` for an integer that does not fit an `i64`, which `json.loads` keeps exact, instead of a rounded float; a number with a fraction or an exponent is still a float. +- `json` returns an encoding error for a truncated or unknown escape, instead of reading past the string. +- `logs.gzipInPlace` writes the archive under a temporary name and renames it into place, so a crash does not leave a partial `.gz` at the final name. +- `proc.groupAlive` retries a `/proc` read interrupted by a signal, instead of reporting that the process group is gone. +- `proc.run` gives the child /dev/null or its pipes on fds 0 to 2 when the caller started with one of them closed: the child's stderr no longer lands in the captured stdout, and its stdin or stderr is no longer closed at exec. +- `proc.run` kills a child that is canceled or times out before it has made its process group, instead of signalling a group that does not exist yet, which let the child run to the end and what it started outlive the call. `proc.stopGroup` likewise kills a child whose pgid `Options.pgid_out` has only just published. +- `proc.run` returns `error.NoChild` when the child's status is lost because the caller ignores SIGCHLD, instead of reporting a kill by signal 9. +- `pytext.pySplit` frees its list when an allocation fails, and the slice it returns is the whole allocation. +- `state.RootLock.acquire` no longer truncates the file behind a hard link planted at `.lock`. It opens the state root `O_DIRECTORY|O_NOFOLLOW` and both lock files relative to it with `O_NOFOLLOW`, creating them mode 0600; a lock file name that is not a regular file with one link is refused before it is opened, so a FIFO or symbolic link there is never followed; and once both locks are held, the gate must still be a regular file whose one link is `.lock` before it is truncated. +- `state.RootLock` also refuses a gate or sidecar that another user owns, as `GateNotPrivate` and `NotPrivate`: each must be a regular file of this user with one link. +- `state.lockExclusive` measures its deadline on the monotonic clock, so a signal that cuts a sleep short does not expire the wait. +- `state.lockExclusive` with a timeout returns a failing flock's own error, with its errno in `sys.last_errno`, as it does without one, instead of `error.Unexpected`. + +### Documentation + +- The `atomic.Ops` doc says the calls can be replaced in a tool's `-Dtest-ops` artifact too, as `atomic.replaceable` allows, not only under `builtin.is_test`. +- `COMPAT.md` names errno 133 as the hardware-error text. Errno 134 is unnamed, which is what glibc prints too. + +### Miscellaneous + +- The test that `proc.groupAlive` stays true while signals arrive sends one signal a millisecond, as the `state.lockExclusive` one does, instead of back to back, which made it take a minute or more on several CPUs and minutes under QEMU. It runs until ten of its checks have caught a signal, so it fails rather than passes when none lands. +- The test that `proc.stopGroup` kills a child whose pgid was only just published runs 50 times instead of 100: without the kill fix it fails within its first three runs either way, and it takes half as long. + + ## 0.8.1 * `atomic` reads the umask from `/proc/self/status` instead of setting it to diff --git a/COMPAT.md b/COMPAT.md index 682c753..19c0a38 100644 --- a/COMPAT.md +++ b/COMPAT.md @@ -2,6 +2,7 @@ | zig-common | Zig | tools built on it | |---|---|---| +| 0.9.0 | 0.17.1 | eessi-arch-guard on its next release (proc.killGroup); eb-keep-logs builds against it in CI | | 0.8.1 | 0.17.1 | eb-staged-rebuild, eb-keep-logs and eessi-arch-guard on their next releases (umask read without changing it, std names without deprecated aliases) | | 0.8.0 | 0.17.1 | eb-staged-rebuild 1.0.0 (errno text as Python prints it, from the errno the kernel gave); eb-keep-logs builds against it in CI | | 0.7.0 | 0.17.1 | eb-staged-rebuild (Zig port; exec errors and the ledger group stop of its build-events path); eb-keep-logs builds against it in CI | diff --git a/build.zig.zon b/build.zig.zon index 84654aa..b3ef056 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,6 +1,6 @@ .{ .name = .zig_common, - .version = "0.8.1", + .version = "0.9.0", .fingerprint = 0xa9bcabd6798f1690, .minimum_zig_version = "0.17.1", .dependencies = .{}, diff --git a/changelog.d/+append-short-write.bugfix.md b/changelog.d/+append-short-write.bugfix.md deleted file mode 100644 index d50a541..0000000 --- a/changelog.d/+append-short-write.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`fsx.appendLine` rolls a short write back, so a full disk does not leave a partial line. diff --git a/changelog.d/+atomic-eintr.bugfix.md b/changelog.d/+atomic-eintr.bugfix.md deleted file mode 100644 index 075b0b9..0000000 --- a/changelog.d/+atomic-eintr.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`atomic` retries an ACL read interrupted by a signal, instead of refusing the replacement. diff --git a/changelog.d/+atomic-errno-text.bugfix.md b/changelog.d/+atomic-errno-text.bugfix.md deleted file mode 100644 index 7f3b2cb..0000000 --- a/changelog.d/+atomic-errno-text.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`atomic` words a failed ACL read with `sys.describeErrno`, glibc's text for every errno Linux names (`[Errno 116] Stale file handle`), instead of its own six-entry table that printed the errno's name for the rest. diff --git a/changelog.d/+atomic-free.bugfix.md b/changelog.d/+atomic-free.bugfix.md deleted file mode 100644 index 058ab86..0000000 --- a/changelog.d/+atomic-free.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`atomic.atomicWrite` frees everything it allocates from the caller's allocator before it returns (the temporary path, the step names, the ACLs it reads and the refusals it wraps), which only an arena used to hide. A refusal's `why.msg` is the caller's, freed by the new `Why.deinit`; the ACLs `readAcls` and `readMetadata` return are freed by the new `Acls.deinit` and `Metadata.deinit`. diff --git a/changelog.d/+atomic-leak.bugfix.md b/changelog.d/+atomic-leak.bugfix.md deleted file mode 100644 index 2640931..0000000 --- a/changelog.d/+atomic-leak.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`atomicWrite` frees the path, the step names and the spare ACL read it allocates. diff --git a/changelog.d/+atomic-ops-doc.doc.md b/changelog.d/+atomic-ops-doc.doc.md deleted file mode 100644 index 2074ab2..0000000 --- a/changelog.d/+atomic-ops-doc.doc.md +++ /dev/null @@ -1 +0,0 @@ -The `atomic.Ops` doc says the calls can be replaced in a tool's `-Dtest-ops` artifact too, as `atomic.replaceable` allows, not only under `builtin.is_test`. diff --git a/changelog.d/+cancel-before-setsid.bugfix.md b/changelog.d/+cancel-before-setsid.bugfix.md deleted file mode 100644 index b3020e3..0000000 --- a/changelog.d/+cancel-before-setsid.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`proc.run` kills a child that is canceled or times out before it has made its process group, instead of signalling a group that does not exist yet, which let the child run to the end and what it started outlive the call. `proc.stopGroup` likewise kills a child whose pgid `Options.pgid_out` has only just published. diff --git a/changelog.d/+copy-offset.bugfix.md b/changelog.d/+copy-offset.bugfix.md deleted file mode 100644 index 1231fdb..0000000 --- a/changelog.d/+copy-offset.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`fsx.copyTo` copies the whole source, whatever the descriptor's offset, and leaves the offset where it was, as its doc says; it copied from the offset to the end and left the offset there. diff --git a/changelog.d/+copy-short-write.bugfix.md b/changelog.d/+copy-short-write.bugfix.md deleted file mode 100644 index da6671e..0000000 --- a/changelog.d/+copy-short-write.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`fsx.copyTo` renames the new bytes into place, so a short write leaves the existing file unchanged. diff --git a/changelog.d/+errno-133.doc.md b/changelog.d/+errno-133.doc.md deleted file mode 100644 index 5ca82eb..0000000 --- a/changelog.d/+errno-133.doc.md +++ /dev/null @@ -1 +0,0 @@ -`COMPAT.md` names errno 133 as the hardware-error text. Errno 134 is unnamed, which is what glibc prints too. diff --git a/changelog.d/+group-alive-eintr.bugfix.md b/changelog.d/+group-alive-eintr.bugfix.md deleted file mode 100644 index 5503de3..0000000 --- a/changelog.d/+group-alive-eintr.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`proc.groupAlive` retries a `/proc` read interrupted by a signal, instead of reporting that the process group is gone. diff --git a/changelog.d/+group-alive-test-speed.misc.md b/changelog.d/+group-alive-test-speed.misc.md deleted file mode 100644 index ca01525..0000000 --- a/changelog.d/+group-alive-test-speed.misc.md +++ /dev/null @@ -1 +0,0 @@ -The test that `proc.groupAlive` stays true while signals arrive sends one signal a millisecond, as the `state.lockExclusive` one does, instead of back to back, which made it take a minute or more on several CPUs and minutes under QEMU. It runs until ten of its checks have caught a signal, so it fails rather than passes when none lands. diff --git a/changelog.d/+gzip-partial.bugfix.md b/changelog.d/+gzip-partial.bugfix.md deleted file mode 100644 index 4833319..0000000 --- a/changelog.d/+gzip-partial.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`logs.gzipInPlace` writes the archive under a temporary name and renames it into place, so a crash does not leave a partial `.gz` at the final name. diff --git a/changelog.d/+json-docs.bugfix.md b/changelog.d/+json-docs.bugfix.md deleted file mode 100644 index cbb5b65..0000000 --- a/changelog.d/+json-docs.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`json.parse` refuses arrays and objects nested more than 32 deep, now `json.max_depth`, whether or not the innermost one is empty; 33 nested empty containers used to parse. The limit is documented, and the module summary covers the parser, both codecs, `toPy` and `dumps`. diff --git a/changelog.d/+json-escape.bugfix.md b/changelog.d/+json-escape.bugfix.md deleted file mode 100644 index 006d50b..0000000 --- a/changelog.d/+json-escape.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`json` returns an encoding error for a truncated or unknown escape, instead of reading past the string. diff --git a/changelog.d/+json-escapes.bugfix.md b/changelog.d/+json-escapes.bugfix.md deleted file mode 100644 index 52a810b..0000000 --- a/changelog.d/+json-escapes.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`json.decodeCache` and `json.decodeWire` return `error.Encoding` for an escape that is cut off, unknown or a `\u` without four hex digits, where they read past the string or took `\u+123` and `\x0041`; what they allocated before the error is freed. `Value.get` does not read past a key that ends in a backslash. diff --git a/changelog.d/+json-int-range.bugfix.md b/changelog.d/+json-int-range.bugfix.md deleted file mode 100644 index 57b8b18..0000000 --- a/changelog.d/+json-int-range.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`json.toPy` returns `error.Encoding` for an integer that does not fit an `i64`, which `json.loads` keeps exact, instead of a rounded float; a number with a fraction or an exponent is still a float. diff --git a/changelog.d/+kill-group.feature.md b/changelog.d/+kill-group.feature.md deleted file mode 100644 index 95b5523..0000000 --- a/changelog.d/+kill-group.feature.md +++ /dev/null @@ -1 +0,0 @@ -`proc.killGroup(pgid, sig)` sends a signal to the process group that `Options.pgid_out` published, or to the child itself while it has not made that group yet, as `proc.run` does. It makes only kill system calls and does not wait, so a signal handler can call it; `proc.stopGroup` also waits for the group to go. diff --git a/changelog.d/+lock-errno.bugfix.md b/changelog.d/+lock-errno.bugfix.md deleted file mode 100644 index dbd901a..0000000 --- a/changelog.d/+lock-errno.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`state.lockExclusive` with a timeout returns a failing flock's own error, with its errno in `sys.last_errno`, as it does without one, instead of `error.Unexpected`. diff --git a/changelog.d/+lock-gate.bugfix.md b/changelog.d/+lock-gate.bugfix.md deleted file mode 100644 index f387f65..0000000 --- a/changelog.d/+lock-gate.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`state.RootLock` also refuses a gate or sidecar that another user owns, as `GateNotPrivate` and `NotPrivate`: each must be a regular file of this user with one link. diff --git a/changelog.d/+lock-timeout.bugfix.md b/changelog.d/+lock-timeout.bugfix.md deleted file mode 100644 index 8c5eb11..0000000 --- a/changelog.d/+lock-timeout.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`state.lockExclusive` measures its deadline on the monotonic clock, so a signal that cuts a sleep short does not expire the wait. diff --git a/changelog.d/+proc-std-fds.bugfix.md b/changelog.d/+proc-std-fds.bugfix.md deleted file mode 100644 index c586839..0000000 --- a/changelog.d/+proc-std-fds.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`proc.run` gives the child /dev/null or its pipes on fds 0 to 2 when the caller started with one of them closed: the child's stderr no longer lands in the captured stdout, and its stdin or stderr is no longer closed at exec. diff --git a/changelog.d/+proc-wait-status.bugfix.md b/changelog.d/+proc-wait-status.bugfix.md deleted file mode 100644 index ed26eda..0000000 --- a/changelog.d/+proc-wait-status.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`proc.run` returns `error.NoChild` when the child's status is lost because the caller ignores SIGCHLD, instead of reporting a kill by signal 9. diff --git a/changelog.d/+pysplit-oom.bugfix.md b/changelog.d/+pysplit-oom.bugfix.md deleted file mode 100644 index 8a550c8..0000000 --- a/changelog.d/+pysplit-oom.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`pytext.pySplit` frees its list when an allocation fails, and the slice it returns is the whole allocation. diff --git a/changelog.d/+replace-gpfs-acl.bugfix.md b/changelog.d/+replace-gpfs-acl.bugfix.md deleted file mode 100644 index 4135ae2..0000000 --- a/changelog.d/+replace-gpfs-acl.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`fsx.replaceContents` copies a GPFS native NFSv4 ACL (`system.gpfs_nfs4_acl`), which it dropped, and, as `atomic` does, copies only the most native ACL form the old file has. GPFS's EINVAL for an NFSv4 form of a file with a POSIX ACL no longer fails the replacement. `fsx.acl_attributes` is the one list of forms, and `atomic` uses it. diff --git a/changelog.d/+rootlock-api.bugfix.md b/changelog.d/+rootlock-api.bugfix.md deleted file mode 100644 index 59e0f64..0000000 --- a/changelog.d/+rootlock-api.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -A refused gate is the new `RootLock.AcquireError.GateNotPrivate` (`NotPrivate` stays the sidecar's), a symbolic link as the state root is `NotDir`, and `LockOps.open_sidecar` takes the state root's descriptor and a name. diff --git a/changelog.d/+rootlock-truncate.bugfix.md b/changelog.d/+rootlock-truncate.bugfix.md deleted file mode 100644 index 72d1dd9..0000000 --- a/changelog.d/+rootlock-truncate.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -`state.RootLock.acquire` no longer truncates the file behind a hard link planted at `.lock`. It opens the state root `O_DIRECTORY|O_NOFOLLOW` and both lock files relative to it with `O_NOFOLLOW`, creating them mode 0600; a lock file name that is not a regular file with one link is refused before it is opened, so a FIFO or symbolic link there is never followed; and once both locks are held, the gate must still be a regular file whose one link is `.lock` before it is truncated. diff --git a/changelog.d/+stopgroup-test-iters.misc.md b/changelog.d/+stopgroup-test-iters.misc.md deleted file mode 100644 index ed06c77..0000000 --- a/changelog.d/+stopgroup-test-iters.misc.md +++ /dev/null @@ -1 +0,0 @@ -The test that `proc.stopGroup` kills a child whose pgid was only just published runs 50 times instead of 100: without the kill fix it fails within its first three runs either way, and it takes half as long.