Repository navigation
feat: consumer lineup helpers (lock u64, atomicWriteAt, createPrivateAt, dumpsCompact, selfExe) - #73
Merged
Merged
Conversation
eb-keep-logs takes a lock wait in seconds, up to 999_999_999 of them, the range flock -w accepts, whose milliseconds a u32 timeout could not hold: the value wrapped and the wait ended at once. The timeout of lockExclusive and lockExclusiveCancel becomes u64 milliseconds, which every existing u32 caller widens into without change, and the deadline arithmetic casts into the i64 the clock uses. The behaviour the consumer's private waitLock kept is already the function's: a timeout of 0 tries once, an interrupted sleep looks at the clock again, and a free lock returns at once. The new test locks a free descriptor with the 999_999_999 seconds and, with the lock held, waits a huge timeout out until the holder lets go, which fails to compile against the u32 signature the base carries.
The metrics writer eb-keep-logs keeps private writes through an open directory it holds for the whole update, pinned there by its lock file, and forces the mode it names whatever the umask leaves, which the path-based atomicWrite does not offer. atomicWriteAt gives that behaviour to the library: the bytes go to a temporary file in the same directory, made durable and renamed over the destination, with the caller's directory descriptor used throughout, and the exact mode set on the descriptor before anything is written, as the private writer's chmod does. It shares atomicWrite's write, sync and rename steps, through the same ops a replaceable build may fail, so the fault coverage the tools' tests get from atomicWrite carries over. The test writes under a restrictive umask and checks the published mode is exactly what was named, replaces an existing destination with its mode, fails a step through the ops and finds the destination unchanged with no temporary left behind; it fails on the base, where the function does not exist.
The guard's new-file writer opens a name with O_EXCL so an existing name, whatever it is, is never replaced, sets the mode on the descriptor so the umask cannot bite it, and refuses a symbolic link without following it. That shape moves into the library beside writePrivate: createPrivateAt takes the caller's open directory descriptor, creates the name exclusively at mode 0600, sets the exact mode the caller names, writes the bytes and closes, with no temporary file and no rename, so another name's file is never touched and an existing name is error.Exists. The test covers a fresh name under a restrictive umask published at the exact mode, the refusal of an existing name with its bytes untouched, the refusal of a symbolic link without following it and a name under a directory the caller holds; it fails on the base, where the function does not exist.
The tools print one JSON document per line, which Python's default json.dumps call writes with the separators of a call without an indent: a comma and a space between items, a colon and a space after each key, everything on one line, ensure_ascii as the default. The library's dumps writes only the indented form, so the guard re-flattened it by hand. dumpsCompact writes that form directly, over the same Py values, sharing the string writer, the float repr and the key ordering, and matching the default call byte for byte. The in-tree test pins the separators, the empty containers and a wrapped document, and fails on the base, where the function does not exist. The json parity probe gains a dumpscompact kind: every fixed document and a seeded hundred random ones, sorted and unsorted, whose output the Python test loads and dumps again with the default call, compared byte for byte, the corpus built at run time as the probe's case set always is. The guard's compact line keeps the separators its own pipeline produces today, the Python default, which the migration kit for this change verifies.
Three of the front ends read their own path the same way, a readlink of /proc/self/exe into a path buffer with a whole-read check, each with its own answer for a read that fails: an optional slice in eb-local, an allocating wrapper with a fallback string in the guard and eb-staged-rebuild. selfExe is that primitive, the slice or null, a failed, empty or truncated read reported as null, the callers choosing what null means over it. The in-tree test names the program as a regular file and fails on the base, where the function does not exist.
This was referenced Nov 20, 2026
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.
Five helpers that the consumer migrations need, stacked after the
sys.strerror fix: the u64 lock timeout, atomicWriteAt, createPrivateAt,
dumpsCompact and selfExe.
The gunzip port is not included here, since this series already carries
the same function bodies and also fixes a doc comment that had been
joined onto one line.
dumpsCompact conflicted with the strerror tests on the shared probe and
the kind table. Both sets of cases are kept.
Consumers repin to the merge commit and its package hash once this lands.