Conversation
.zi-prepare-home set ZI[HOME_READY]=1 on its second line, before doing any
directory work, and created ZI[SERVICES_DIR] only inside the branch guarded on
ZI[SNIPPETS_DIR] being absent.
A tree with snippets/ present and services/ missing, which a migration or a
manual repair can leave behind, therefore completed without creating the
services directory and was still recorded as ready:
PROBE before: snippets=1 services=0
PROBE prepare rc=0
PROBE after: services=0
PROBE HOME_READY=1
Service startup then places locks and FIFOs below a directory that does not
exist, and the flag prevents any later call from repairing the layout.
Give the services directory its own condition, validate the required set before
recording readiness, and set ZI[HOME_READY] only after that passes. A failure
now reports which directory is missing and leaves the flag unset, so a later
call retries.
$ZPFX and the manual directory stay best-effort. They are user-facing install
prefixes rather than Zi's own state, and the manual tree has always tolerated a
creation failure through `mkdir 2>/dev/null'. Treating them as required would
turn a read-only prefix into a startup failure for shells that work today.
tests/home-preparation.zsh covers the partial layout, a required directory that
cannot be created, the retry after the cause is removed, and the no-op on an
already-ready home. It skips itself under root, where the permission case cannot
hold. Against the previous function it reports `partial layout: the services
directory was not created'.
Closes #448
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.
.zi-prepare-homerecorded the home as ready before doing any work, and created the services directory only as a side effect of creating the snippets directory.The defect
A tree with
snippets/present andservices/missing, which a migration or a manual repair can leave behind, completes without creating the services directory and is still recorded as ready:Service startup then places locks and FIFOs below a directory that does not exist, and
ZI[HOME_READY]=1stops any later call from repairing the layout.The fix
Three changes, matching the acceptance criteria:
ZI[HOME_READY]is set only after that validation passes, so a failure stays retryableWhat is deliberately not required
$ZPFX/{bin,lib,share}andZI[MAN_DIR]stay best-effort. They are user-facing install prefixes rather than Zi's own state, and the manual tree has always tolerated a creation failure throughcommand mkdir 2>/dev/null -p. Promoting them to required would turn a read-only prefix into a startup failure for shells that work today, which is a bigger behaviour change than this issue asks for. The comment in the source says so.Test
tests/home-preparation.zshcovers the partial layout, a required directory that cannot be created, the retry once the cause is removed, and the no-op on an already-ready home. It skips itself under root, where the permission case cannot hold, and restores permissions in itstrapso cleanup works.Against the previous function:
Registered in
zsh-n.yml, both path filters and a job. Full suite 25/25.Closes #448