Skip to content

chore(release): 0.14.0 - #103

Merged
HaoZeke merged 54 commits into
mainfrom
chore/release-0.14.0
Nov 27, 2026
Merged

HaoZeke merged 54 commits into
mainfrom
chore/release-0.14.0

Conversation

@HaoZeke

@HaoZeke HaoZeke commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

chore(release) :: 0.14.0

The branch is develop plus the one commit cog bump --version 0.14.0 made, so merging it carries develop into main (53 commits) with the release. The bump commit changes no file: the build.zig.zon version, the COMPAT.md row and the CHANGELOG.md section for 0.14.0 are already on develop from #102, and the cog.toml hooks passed against them. The tag v0.14.0 is on the bump commit and is pushed after the merge.

0.14.0 returns a failed close where the library ignored it: atomic.atomicWrite and atomicWriteAt, state.writePrivate and createPrivateAt, fsx.copyTo, moveAcross, replaceContents, appendLine, TempDir.get and logs.gzipInPlace close, and check the close of, the file before the rename that publishes it, so a write that NFS reports lost at the close is no longer returned as success. state.RootLock.release reports a failed release. It adds logs.gzipInPlaceAtStep and env_scrub.childClearNames.

Source-breaking: fsx.absPath returns Error as well as Allocator.Error, so a caller that switches exhaustively on its errors needs a new branch; a removed working directory is error.NotFound. state.RootLock.release now returns an error that callers used to lose.

Verified on x86_64 with Zig 0.17.1: zig fmt --check, zig build test (266 of 266 pass), and eb-keep-logs zig built and tested against this checkout (8 of 8 steps).

Merge with a merge commit, so the tagged commit is on main.

Each tool clears the European Environment for Scientific Software
Installations (EESSI) install locations and EasyBuild's install paths
from a list of its own. zig-common keeps that list in
src/env-scrub.json. env_scrub.childClearNames returns the names in
the order eb-local env prints them.
`RootLock.release` ignored a failed `fcntl(F_SETLK, F_UNLCK)` or
`flock(LOCK_UN)`, so the caller exited successfully. The Python
reference closes both descriptors and then lets the `OSError` out.
`release` returns `sys.Error!void` and does the same: both descriptors
are closed whatever either lock call returns, and the first error is
returned after the second close. `sys.last_errno` is restored to the
errno of that first error, so `sys.describe` names the call whose error
is returned.

The `rootlock` mode of the filesystem parity probe reports a failed
release in its status, and the API reference lists `sys.Error` for
`release`, the set its signature names.
The lock tests count `/proc/self/fd` with a helper in the test file.
That helper now lives in one shared test file, and a failed read of
the directory returns an error.
The proc tests had their own helper that forks a child and retries an
interrupted `wait4`. That wait now lives in the shared test helper,
and the proc tests call it there.
`sys.keepAboveStdio` returns `error.Unexpected` when duplication fails
with `EMFILE`, and the original descriptor stays open. A child lowers
`RLIMIT_NOFILE`, fills the table, and restores the limit.
The test counts `/proc/self/fd` before and after each `proc` path that
calls `sys.keepAboveStdio`. The later count matches the earlier one.
chore: sync develop with main after 0.13.0
fix: publish one list of install variables to clear
…dcount

test: keepAboveStdio EMFILE and descriptor-count coverage
gzipInPlace returns the same error set from every step. A caller cannot
tell a log left as it was from a log whose archive is in place with the
original removed and only the final directory sync failed. A rotate that
counts compressed logs needs that difference. Guessing it from the error
value or from a stat afterwards is wrong when another process changes
the same directory.

gzipInPlaceAtStep takes a GzipStep out-parameter. It starts as archive
and becomes directory_sync once the archive is renamed into place and
the original removed, right before the archive's directory is opened
and synced. On an archive error the original file stays in place and
the call left no archive. On a directory_sync error the archive is in
place and the original is gone. gzipInPlace keeps its signature and
calls gzipInPlaceAtStep with a step of its own.

One test refuses an existing archive and a missing log, and expects
archive both times with the log left in place. The other test lowers
the soft descriptor limit to just above the two descriptors the archive
step needs. Opening the directory for the sync is then the first call
refused. That test expects directory_sync, EMFILE, an archive that
gzip -t accepts and no original. Both tests fail to build on the
parent, which has no gzipInPlaceAtStep.
feat: report the step a gzipInPlace error came from
Add both to the logs section of the API reference, and a note on reading
the step to the compress-and-mark-logs how-to.
If opening the original fails, the archive step changes nothing. After
an earlier run compressed it, `name` stays gone. Any `name.gz` from an
earlier run stays as it was. Once the original is open, the step keeps
it. It leaves `name.gz` behind only when that file existed before, or
when it failed to remove the original and then failed to remove the
archive. The `directory_sync` step follows one rename and one unlink,
not two renames.
test_support.ScratchDir makes .zig-cache/zig-common-TAG-PID empty,
removing one a killed run left under the same pid, and fails when it
cannot create it. The logs tests and the fsx moveAcross fixture use it in
place of their own copies, so writeLog's O_EXCL create cannot hit a stale
file.
docs: list GzipStep and state what an archive error leaves
The case uses `state.lock_ops` to make the `fcntl` release fail, the
`flock` release fail, and both fail at once, each with its own errno.
It then checks three things. `release` returns the record lock's
error first. Neither descriptor stays open. The state root can be
locked again. `sys.last_errno` and `sys.describe` must name the errno
of the returned error, `.IO` when both fail.
fix: report a failed release of the state-root lock
writePrivate closed the temporary file in a defer that ran after the
rename and dropped the result of close. On a network file system (NFS)
a write the server loses can be reported by close alone, so the name
was replaced with a file whose bytes may be gone and the call returned
success. The Python tools this port follows close before os.replace and
raise on a failed close, so they never replace the name in that case.

The temporary file is synced and closed before the rename. A failed
fsync or close is returned as sys.Error with sys.last_errno set to its
errno, the name is left as it was, and the temporary file is removed.
The removal keeps that errno, so sys.describe names the failed call.
The descriptor is closed once on every path: by the close before the
rename, or by the cleanup when an earlier call fails.

close is called once and its result goes through sys.result. `EINTR`
is not retried, because Linux frees the descriptor before close returns
and a retry could close a descriptor another thread has just opened.
sys.result returns null for `EINTR` rather than an error, so that close
is not an error either. The fsync before it has flushed the bytes, so
that close has nothing left to lose.

fsync and close go through state.write_ops, replaceable in the same
builds as state.lock_ops and constant real calls in any other build.
Through state.write_ops, the cases make fsync fail with `EIO` or
`ENOSPC`, and close with `EIO`, `ENOSPC` or `EDQUOT`. Those are the
errors a network file system (NFS) reports for a lost write. Each case
runs over an existing name and over a name that does not exist yet. Each
expects the mapped error with sys.last_errno and sys.describe naming
that errno, one close of the descriptor, the descriptor count from
before the call, the existing name with its old bytes, no new name and
no temporary file. A close that reports `EINTR` expects success, one
close and the new bytes. A sync that reports `EINTR` once expects a
second sync, one close and the new bytes. A plain write expects one
close.

The close hook closes the descriptor for real before it reports its
errno, as Linux does, so a leak or a second close shows in the counts.
On develop before this series the tests fail to build, as it has no
state.write_ops.
fix: report fsync and close errors from writePrivate
atomicWrite and atomicWriteAt close the temporary file once, before
the rename. A failed close removes the temporary file, leaves the
destination unchanged, and returns the errno the other steps return.
A close that a signal interrupts is not retried and is not an error,
which is how sys.result treats it. The close goes through atomic.ops
so a test can inject a failure.
replaceContents closes the file once, before the rename that
publishes it. moveAcross does the same for each regular file it
copies. A failed close returns its errno and removes the temporary
path. The destination stays as it was. A close that a signal
interrupts is not retried and is not an error, which is how
sys.result treats it. The close goes through fsx.publish_ops so a
test can inject a failure.
fix: check the close of atomically written files
fix: check the close of files fsx publishes
Flush, sync and close the temporary archive before renaming it
over the log's .gz name. A failed close returns its errno and
removes the temporary file. The log and any existing archive stay
as they were. A close that a signal interrupts is not retried and
is not an error, since Linux has already freed the descriptor.
appendLine returns a failed close. On a network file system (NFS) a lost
write may show up only at the close. The old code discarded that result,
so an append could succeed even though the line never reached the
server.

A close that a signal interrupts counts as success and is not retried,
because the system has already released the descriptor. A failed close
returns its error. The line is not removed: the descriptor is gone, so
the file cannot be safely shortened back to its old size. On an earlier
error the cleanup close ignores its result. The earlier error keeps its
errno.
fix: check the close of logs gzip writes
fix: check the close of lines fsx appends
state.createPrivateAt returns the error from the close of the file it
creates, and leaves that errno in sys.last_errno. A close that a
signal interrupts is success and is not retried, because Linux has
already freed the descriptor. A write that a network file system
reports lost is visible at that close, so the call no longer returns
success for a file whose bytes never reached the server. A close
after an earlier error is ignored and the earlier errno is kept. The
created name stays in place when the call fails.
…check

fix: check the close of private files state creates
Some directory closes are now checked.

The checked closes are the ones that follow a sync the caller relies
on. They go through the same replaceable calls as a file close. A
failed close is returned. A close that a signal interrupts counts as
success and is not retried. Cleanup closes after an earlier error
ignore their result and keep the earlier errno. What is left at the
target name is unchanged.
The module table omitted argparse, which src/root.zig exports. The 0.13.0 row of COMPAT.md omitted eb-local, which pins 0.13.0 in its build.zig.zon.
copyTo now closes its temporary file before the rename.

copyTo used to rename the synced temporary file while it was still
open. The caller closed it later and ignored the result. A write that
a network file system reports lost only at close had already replaced
the destination, and copyTo returned success.

The close goes through publish_ops, like the other publish closes. A
failed close is returned, the destination is left as it was, and the
temporary file is removed. A close that a signal interrupts counts as
success and is not retried. A cleanup close after an earlier error
keeps that error. The caller still gets an open descriptor of the
published file, positioned at the end.
fix: check the close of files copyTo publishes
TempDir.get used to ignore the close of the probe file it writes
before it keeps a directory. A write that a network file system
reports lost only at close still counted as success, and the
directory stayed chosen for the rest of the process.

The close goes through temp_probe_ops. A failed close leaves that
directory unchosen and removes the probe file. A close that a
signal interrupts counts as success and is not retried. A cleanup
close after an earlier error keeps that error.
fix: check the close of the temp directory probe
README lists argparse; COMPAT names eb-local
Remove the non-Linux `NSRNODATA` and `NSRCNAMELOOP` strerror
case, the `which` fixture that repeats the boundary test, and
the listed NFSv4 and General Parallel File System `EINVAL`
refusals. Those two models are already one pass of the models()
loop.

Zig tests: 285 to 281.
One scratch directory drives the named-pipe refusals of openRegular,
appendLine, copyTo and both moveAcross paths. Each group is one
table. The groups are the POSIX mask pairs, the unlisted `EINVAL`
models, the closed standard streams, the whichShutil path rows, and
the moveAcross directory syncs. Every previous case stays a row.

Zig tests: 281 to 265.
An unset PATH is resolved through `default_path`, pointed at a
temp directory that stores an executable `sh`. `describe` keeps
the errno strings and no longer reads `COMPAT.md` from the
process cwd. `send` uses an injected `connect` that returns
`ECONNREFUSED` instead of two connects to missing sockets.

Zig tests: 265, unchanged.
Pin the argparse fuzz seed and draw 300 vectors from the pool.
Hold and try the flock for `30 ms`. Fault gzip before the rename
on `4 KiB` instead of compressing `6 MiB`. Bound the proc
deadlines at `50 ms`, the kill grace at `20 ms`, and the lock
waits at `30 ms`. Drop the pause after the noisy helper's pid
file appears, and stop the descendant script after `0.05 s`.
Stream one byte past the cap. One tempdir process per test reads
every environment from stdin. The pre-group cancel is one
iteration.

Zig `zig build test` wall on this machine: `4 s` to `888 ms`.
Zig tests: 265, unchanged. Python methods: 48, unchanged.
Block the child on a pipe before `setsid`, call `stopGroup`,
then release the pipe. One cancel before the group is made,
with no `1 s` poll. `lockExclusive` gets one `SIGUSR1` and must
return `error.TimedOut` at or after the deadline, with no
upper bound; the timed acquire drops that bound too.
`groupAlive` retries one injected `EINTR` and does not signal
the process. Argparse fuzz is pinned to Python 3.14.10 and
seed 1652137504, and compares the choice set rather than the
quotes. External doc links are a report and do not fail the
build.

Zig tests: 265, unchanged. `zig build test` run step:
`4 s` to `624 ms`.
`fsx.absPath` joined a relative path onto the `(deleted)` suffix
`/proc` gives for a removed working directory. `os.path.abspath`
raises `ENOENT` from `getcwd` there. Return that error.
fix: report a removed cwd from absPath
`proc.resolveExecutable` maps every `getcwd` failure to null
through its `else => null` arm. That covers a removed working
directory, `ERANGE` (the path does not fit the buffer) and any
other error.

`fsx.absPath` now returns `Error` as well as `Allocator.Error`.
Callers that switch exhaustively on its errors have to handle
the wider set. A removed working directory is `error.NotFound`.
The changelog fragment records both.
Bump `.version` in `build.zig.zon` to `0.14.0`. The wider error set
of `fsx.absPath` is source-breaking, so the bump is minor.

Record the `0.14.0` row in `COMPAT.md`. Build `CHANGELOG.md` with
`towncrier build --yes --version 0.14.0`.
chore(release): prepare zig-common 0.14.0
@HaoZeke
HaoZeke merged commit c9b0e31 into main Nov 27, 2026
8 checks passed
@HaoZeke
HaoZeke deleted the chore/release-0.14.0 branch November 27, 2026 03:37
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.

1 participant