Repository navigation
Conversation
A failed open of the temporary file named the destination. A failed write or flush named it as well, and a failed rename named only that destination. Python names the temporary file, no file, or both files. The message follows Python.
A failed open of .lock named the state root, and so did a failed pid write. Python names .lock, .lock.posix, the directory, or no file. The acquisition snapshots that text before a later close.
cli.put, cli.print, and cli.out ignore write failures, which suits diagnostic output on stderr while leaving callers that capture or evaluate stdout unaware of EBADF or ENOSPC. Front ends that print both multi-line status and captured documents had to maintain their own write wrapper and sticky failure flag. Add cli.Stdout with write, print, and finish methods plus one-shot cli.writeOut. On the first write failure, Stdout sets failed, prints "TOOL: cannot write output (ERRNO)" on err_fd, and returns false; later writes return false without repeating the diagnostic, and finish turns exit status 0 into 1. Tests cover short and heap-formatted writes, sticky EBADF and ENOSPC reporting, exit status conversion, and cli.writeOut on /dev/full.
A run directory's log can carry a name close to a filesystem's own 255-byte limit on one path component. It can still sit well inside what the reference compressor at its highest setting allows. Its own overhead is just the three bytes of the `.gz` suffix it adds. `gzipInPlace` writes its compressed bytes to a temporary name first. That way a crash or a short write cannot leave a partial archive under the final name a later run would skip. The temporary name carried the original name in full, plus a pid and a random suffix guarding it from a concurrent or a retried run. Nothing checked whether the result still fit in one path component once that suffix was added on. A name as short as 232 bytes, well under the reference tool's own limit, could report NameTooLong. The pid and the random suffix alone are already enough to keep two temporary files from colliding in the same directory. The original name is left out of the temporary one when adding it on would overflow a path component. That way a compression the final name alone would have gone on to complete does not fail. A name under the reference compressor's own 252-byte limit compresses here too, regardless of the temporary name's own overhead. One past even that limit still reports NameTooLong, exactly as the reference tool itself would refuse it. A 240-byte name is picked so the prior temporary name overflows whatever the running process's own pid happens to be. It reports NameTooLong on the parent commit, and compresses here. A full `zig build test` run reports every other case still passing.
State-root preflight failures now populate osFailure. Lock-file errors carry their full joined paths, while non-operating-system lock refusals leave osFailure empty.
Recursive directory creation now carries the path passed to the system call that failed. Atomic writes and state locks use that ancestor in their OSError diagnostics.
Lock acquisition starts with a clean errno before synthesizing a short-write failure. Atomic replacement cleanup no longer probes a temporary path after that path has been renamed away.
Every allocation failure while formatting an OSError now keeps that system error and uses the static fallback message. Atomic-write callers deinitialize diagnostics after any failure.
Pushes to develop and pull requests against it now trigger the same workflows as main. Deploy jobs still publish from main only.
…1120 Compress long log names that gzip accepts
feat: add checked stdout writer to cli
The CI runs the JSON, filesystem and tempfile.gettempdir parity suites under the Python 3.14 installed by actions/setup-python, but not the argparse parity suite. Add a step that builds argparse-parity-probe and runs tests/test_argparse_parity.py, guarded by a Python 3.14+ version assertion so the argparse differential classes cannot skip on an older interpreter.
CHANGELOG.md stopped at 0.9.0 while tags v0.10.0, v0.11.0 and v0.12.0 were cut without running towncrier, leaving their news fragments unconsumed under changelog.d/. Run towncrier in release order for 0.10.0 (2026-11-18, 7 fragments), 0.11.0 (2026-11-19, 31 fragments) and 0.12.0 (2026-11-19, 2 fragments) using each tag's date and the set of fragments first present at that tag. The 46 post-v0.12.0 fragments remain under changelog.d/ for the next release.
The moveAcross tests could watch named steps and inject a failure at one, but they could not see which directory a sync flushed. A test that moves to a nested name therefore passed whether the code synced the root descriptor or the parent that gained the entry. MoveFaults now takes a trace function. moveAcross reports each rename and each directory sync it completes through that function. A sync reports the open descriptor, so a test can stat it while the trace runs. Without a trace function the calls are the same as before. A unit test records both paths for a move between two flat names in one directory. The rename path makes one rename and one sync of that directory. The copy path makes one rename and two syncs of it, one after the publish and one after the source is removed.
moveAcross flushed the root destination descriptor after publishing, so a nested destination left the directory that receives the new entry unsynced. The temporary name already follows the destination parent through the shared helper. Both the rename path and the copy path now open the parent of the destination name and flush it, as copyTo does. The sync goes through the moveAcross trace, so a test can see which directory it reached. A unit test moves a file to a name under a subdirectory, once by rename and once through the forced copy path. Each trace must show a sync of that subdirectory after the last rename. With the root descriptor synced instead, both checks fail.
The rename path skipped the source sync when both names came from one descriptor. That was safe while the destination sync flushed the same descriptor. The destination sync now flushes the parent of a nested name. A move from dir/src to dir/sub/dst therefore flushed only dir/sub, and the removal of src from dir was never synced. The copy path synced the source descriptor after the unlink, which is the wrong directory for a nested source name such as a/src. Both paths now sync the parent of the source name. The rename path skips it only when the two names share a descriptor and the same parent path, since one sync then covers both entries. The copy path always syncs it, because the unlink comes after the publish sync. A unit test moves a flat source and a nested source to a nested destination by rename. It then moves a nested source through the forced copy path. Each trace must show syncs of the destination parent and the source parent after the last rename. A move between two names in one subdirectory must make one rename and one sync of that subdirectory.
ci: run argparse parity suite on Python 3.14
…0.12 Backfill changelog for 0.10.0 through 0.12.0
…arent fix: sync nested moveAcross destination parent
Keep OS errors and match Python OSError text for atomic writes and state locks
The parity probe reported only the Zig error name when an atomic write failed, and it never acquired a state lock. A wrong path or a dropped OSError text could not be seen from Python. Print the full atomic-write diagnostic, and the state lock's text and path. The test raises open, write, rename, missing-parent, permission, lock file and POSIX sidecar failures, and compares that text with the OSError Python raises for the same call. Cleanup restores a mode-0555 directory before removing it, and a write-fsize skip no longer requires the process to run as root.
A failed stat or unlink of the temporary file runs after the OSError text has been built. That cleanup used to replace sys.last_errno, so a later describe saw the cleanup error instead of the original one. atomicWriteAt's cleanup unlink keeps it the same way. Tests make that cleanup fail with a different errno and require the original to remain.
osFailure returns slices of thread-local storage and had no doc comment, so the generated API page did not say that the next acquire on the same thread reuses them.
F_SETLKW treated EAGAIN and EACCES as Unexpected. describe of that error ignores EACCES and prints an I/O error, while the snapshot kept permission denied. Return the mapped error so the two agree: EAGAIN stays Unexpected and EACCES is AccessDenied.
Keep the original errno in atomic-write and lock errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Promote develop (3e17752) to main (85b8e9f).
Merged PRs since v0.12.0 (556a92c):
Already on main: #48, #52, #53, #54, #55, #56, #57, #58, #60, #61, #62, #63, #64, #65, #66, #67, #69, #72, #73, #74, #76, #81
New in this promotion: #59, #70, #75, #77, #79, #83, #84