Skip to content

fix: report the file Python names for failed replace, makedirs and lock calls - #71

Closed
HaoZeke wants to merge 7 commits into
developfrom
fix/oserror-paths-lock-makedirs
Closed

HaoZeke wants to merge 7 commits into
developfrom
fix/oserror-paths-lock-makedirs

Conversation

@HaoZeke

@HaoZeke HaoZeke commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Four zig-common fixes that make failed filesystem calls report the file
Python names.

The stack names the file a failed replacement reports, names the
directory a failed makedirs reports, records which lock call failed so a
caller can name the right file, and returns an unlock error from the
state-root lock instead of dropping it. Each commit has one fragment and
its own test.

Draft: this branch also carries the five consumer lineup helper commits it is stacked on, which are not in main yet.

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.
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.
RootLock.release ignored a failed flock(LOCK_UN), so the caller exited
successfully. The Python reference raises the operating-system error
after it closes both descriptors. The release now does the same and
returns the error after closing them.
@HaoZeke
HaoZeke force-pushed the fix/oserror-paths-lock-makedirs branch from cad791d to 6939a09 Compare November 20, 2026 19:45
@HaoZeke
HaoZeke changed the base branch from main to develop November 21, 2026 05:33
@HaoZeke

HaoZeke commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #89, merged into develop as a45142a.

@HaoZeke HaoZeke closed this Nov 25, 2026
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