Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
dad46da
fix(atomic): retry an interrupted ACL read and free its scratch
HaoZeke Nov 16, 2026
6901bf9
fix(fsx): a short write does not destroy the destination
HaoZeke Nov 16, 2026
7fc7025
fix(state): a lock waits out signals and refuses a foreign gate
HaoZeke Nov 16, 2026
abe21fa
fix(json): a truncated escape is an encoding error
HaoZeke Nov 16, 2026
9dd22cc
fix(pytext): free pySplit's list when allocation fails
HaoZeke Nov 16, 2026
0f81f20
fix(logs): do not publish a partial gzip under the final name
HaoZeke Nov 16, 2026
170141d
fix(proc): a signal during a /proc scan is not an empty group
HaoZeke Nov 16, 2026
9bb9813
docs: errno 133 is the hardware-error text
HaoZeke Nov 16, 2026
7b717fd
test(proc): a standard descriptor closed at start
HaoZeke Nov 16, 2026
39a292a
fix(proc): a standard descriptor closed at start keeps the child's st…
HaoZeke Nov 16, 2026
6d209c7
test(proc): a status lost to an ignored SIGCHLD
HaoZeke Nov 16, 2026
de97e8f
fix(proc): a lost exit status is an error, not signal 9
HaoZeke Nov 16, 2026
2487373
test(json): a truncated or malformed escape
HaoZeke Nov 16, 2026
fe15bec
fix(json): a truncated or malformed escape is an encoding error
HaoZeke Nov 16, 2026
303616d
test(json): an integer past i64
HaoZeke Nov 16, 2026
8687fa6
fix(json): an integer past i64 is an error, not a rounded float
HaoZeke Nov 16, 2026
5b254d3
test(json): arrays and objects nest at most 32 deep
HaoZeke Nov 16, 2026
6b67296
fix(json): one nesting limit of 32, documented with the module
HaoZeke Nov 16, 2026
7ef8ba9
test(fsx): copyTo after the source was read
HaoZeke Nov 16, 2026
294bb8c
fix(fsx): copyTo copies the whole file and leaves the offset
HaoZeke Nov 16, 2026
91c0c78
test(fsx): replaceContents over GPFS and NFSv4 ACL models
HaoZeke Nov 16, 2026
e22da64
fix(fsx): replaceContents keeps a GPFS ACL, in its most native form
HaoZeke Nov 16, 2026
1763471
test(atomic): a failed ACL read prints its errno's full text
HaoZeke Nov 16, 2026
7cfb3a2
fix(atomic): word ACL read failures with sys.describeErrno
HaoZeke Nov 16, 2026
edcb2db
test(atomic): atomicWrite frees what it allocates but a refusal's mes…
HaoZeke Nov 16, 2026
7b9ee38
fix(atomic): free what atomicWrite allocates
HaoZeke Nov 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
# Changelog

## Unreleased

* `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.
* 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.
<!-- towncrier release notes start -->

## 0.8.1

Expand Down
6 changes: 4 additions & 2 deletions COMPAT.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ breaks a tool shows before the tool moves to it.

`sys.describe` prints glibc's `strerror` text, as Python's `os.strerror` does,
for every errno the Zig standard library's `linux.E` names. An errno it does
not name prints `[Errno N] Unknown error N`; on x86_64 that is errno 134,
which glibc calls "Memory page has hardware error".
not name prints `[Errno N] Unknown error N`. On x86_64, errno 133 is
`HWPOISON`, `[Errno 133] Memory page has hardware error`, and errno 134 is
not a named errno: both glibc and this library print `[Errno 134] Unknown
error 134`.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ the entry and its hash.
| module | what it does |
|---|---|
| `sys` | `std.os.linux` calls with EINTR retried and errno mapped to a Zig error set |
| `fsx` | open without following a final symbolic link, checks on the descriptor (`fstat`), cp-style copy, line append, atomic replace keeping owner, mode and access ACLs, directory iteration, `rm -rf` that never follows links, `realpath` through `/proc/self/fd` |
| `fsx` | open without following a final symbolic link, checks on the descriptor (`fstat`), a copy that renames into place so a short write does not destroy the destination, line append, atomic replace keeping owner, mode and access ACLs, directory iteration, `rm -rf` that never follows links, `realpath` through `/proc/self/fd` |
| `proc` | run a program by absolute path with an empty signal mask, default handlers and no descriptors above 2, by default in its own session; stdin fed and stdout and stderr read at once, each with a cap; an optional deadline, SIGTERM, a grace period, SIGKILL to the process group; a cancel flag a signal handler can set; group members left after the child exits are killed before it is reaped; `which` looks a name up in an explicit PATH |
| `logs` | `gzip -9` in place with gzip's header (name, mtime, OS byte), owner, mode and times kept; rewrite of `.licensed-logs` entries |
| `env` | the environment as raw bytes with getenv's first-entry rule, duplicate names found, a child environment built with each name once, shell name check |
| `state` | private files in a shared directory: trusted only when the open file is a regular file of this user with one link and no group or other bits, a lock trusted the same way, atomic 0600 writes; `RootLock`, a flock gate plus a POSIX record lock on a sidecar, with a deadline |
| `state` | private files in a shared directory: trusted only when the open file is a regular file of this user with one link and no group or other bits, a lock trusted the same way, atomic 0600 writes; `RootLock`, a flock gate plus a POSIX record lock on a sidecar, with a deadline read from the clock. The gate and the sidecar must each be a regular file of this user with one link |
| `json` | a JSON reader with Python's two string encodings (surrogateescape text, one byte per code point), Python values, and `json.dumps(indent=N, sort_keys=True)` byte for byte, float repr included |
| `pytext` | byte strings as Python text: the surrogateescape character, the 'replace' decoder, str.isspace, strip and split, shlex.quote |
| `atomic` | `atomic_write`: replace a file only after its bytes, owner, mode and every ACL form (GPFS NFSv4, NFSv4, POSIX access) are durable and read back; fault points before write, fsync and rename |
Expand Down
1 change: 1 addition & 0 deletions changelog.d/+append-short-write.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`fsx.appendLine` rolls a short write back, so a full disk does not leave a partial line.
1 change: 1 addition & 0 deletions changelog.d/+atomic-eintr.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`atomic` retries an ACL read interrupted by a signal, instead of refusing the replacement.
1 change: 1 addition & 0 deletions changelog.d/+atomic-errno-text.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`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.
1 change: 1 addition & 0 deletions changelog.d/+atomic-free.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`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`.
1 change: 1 addition & 0 deletions changelog.d/+atomic-leak.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`atomicWrite` frees the path, the step names and the spare ACL read it allocates.
1 change: 1 addition & 0 deletions changelog.d/+copy-offset.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`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.
1 change: 1 addition & 0 deletions changelog.d/+copy-short-write.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`fsx.copyTo` renames the new bytes into place, so a short write leaves the existing file unchanged.
1 change: 1 addition & 0 deletions changelog.d/+errno-133.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`COMPAT.md` names errno 133 as the hardware-error text. Errno 134 is unnamed, which is what glibc prints too.
1 change: 1 addition & 0 deletions changelog.d/+group-alive-eintr.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`proc.groupAlive` retries a `/proc` read interrupted by a signal, instead of reporting that the process group is gone.
1 change: 1 addition & 0 deletions changelog.d/+gzip-partial.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`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.
1 change: 1 addition & 0 deletions changelog.d/+json-docs.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`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`.
1 change: 1 addition & 0 deletions changelog.d/+json-escape.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`json` returns an encoding error for a truncated or unknown escape, instead of reading past the string.
1 change: 1 addition & 0 deletions changelog.d/+json-escapes.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`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.
1 change: 1 addition & 0 deletions changelog.d/+json-int-range.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`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.
1 change: 1 addition & 0 deletions changelog.d/+lock-gate.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`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.
1 change: 1 addition & 0 deletions changelog.d/+lock-timeout.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`state.lockExclusive` measures its deadline on the monotonic clock, so a signal that cuts a sleep short does not expire the wait.
1 change: 1 addition & 0 deletions changelog.d/+proc-std-fds.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`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.
1 change: 1 addition & 0 deletions changelog.d/+proc-wait-status.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`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.
1 change: 1 addition & 0 deletions changelog.d/+pysplit-oom.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`pytext.pySplit` frees its list when an allocation fails, and the slice it returns is the whole allocation.
1 change: 1 addition & 0 deletions changelog.d/+replace-gpfs-acl.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`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.
1 change: 1 addition & 0 deletions changelog.d/+rootlock-api.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
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.
1 change: 1 addition & 0 deletions changelog.d/+rootlock-truncate.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`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.
Loading
Loading