fix(post-install): close declarative post-install step gaps - #787
Merged
Conversation
A keg-only formula that publishes its launcher and completions from post_install installed with nothing on PATH. Those steps name their source with a keg-relative template rather than a base, and the executor did not resolve those tokens, so the path never became absolute and the symlink was refused as relative. The companion remove step was not implemented at all, leaving a stale launcher behind. The templates now resolve against the keg, and remove is a guarded delete: it retires a symlink identified by a substring of its target, so a regular file or a link pointing elsewhere at the same path survives. Reading the link doubles as the type check, and the link is unlinked, never followed. Note the deliberate split between a keg-relative template and a same-named prefix base; both appear in one step when a keg-only formula publishes into the prefix.
Formulas that fill in a shipped config from post_install installed with the placeholder still in it — a config naming a user that does not exist, behind an install that reported success. The inreplace step was not implemented, and neither were the etc and user tokens its steps depend on. Because the target is live user configuration, the step refuses rather than guesses and the write is atomic. An unresolved token is never substituted: writing the literal token into a config is worse than declining. There is no regex engine here, so only the anchored whole-line shape upstream uses is honoured, behind a strict metacharacter allowlist — approximating a richer pattern would corrupt the file silently. An unmet guard skips the step instead of inventing configuration.
indaco
force-pushed
the
fix/post-install-steps-symlink-remove
branch
from
July 27, 2026 08:08
639dff9 to
c56d249
Compare
indaco
added a commit
that referenced
this pull request
Jul 27, 2026
* fix(post-install): publish keg-only launchers and retire stale links A keg-only formula that publishes its launcher and completions from post_install installed with nothing on PATH. Those steps name their source with a keg-relative template rather than a base, and the executor did not resolve those tokens, so the path never became absolute and the symlink was refused as relative. The companion remove step was not implemented at all, leaving a stale launcher behind. The templates now resolve against the keg, and remove is a guarded delete: it retires a symlink identified by a substring of its target, so a regular file or a link pointing elsewhere at the same path survives. Reading the link doubles as the type check, and the link is unlinked, never followed. Note the deliberate split between a keg-relative template and a same-named prefix base; both appear in one step when a keg-only formula publishes into the prefix. * fix(post-install): template config files from declarative steps Formulas that fill in a shipped config from post_install installed with the placeholder still in it — a config naming a user that does not exist, behind an install that reported success. The inreplace step was not implemented, and neither were the etc and user tokens its steps depend on. Because the target is live user configuration, the step refuses rather than guesses and the write is atomic. An unresolved token is never substituted: writing the literal token into a config is worse than declining. There is no regex engine here, so only the anchored whole-line shape upstream uses is honoured, behind a strict metacharacter allowlist — approximating a richer pattern would corrupt the file silently. An unmet guard skips the step instead of inventing configuration. (cherry picked from commit 9751540)
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.
Description
Two kinds of formula installed successfully and were then unusable.
A keg-only formula that publishes its launcher from post-install landed with nothing on PATH: those steps name their source with a keg-relative template, the executor did not resolve those tokens, and the resulting path was refused as relative. Its companion cleanup step was not implemented at all, so a stale launcher survived.
The two new steps edit things that belong to someone else — a link in the prefix, a live config — so both are deliberately conservative: the delete only retires a symlink it can identify
as its own, and the substitution refuses anything it cannot fully account for rather than guessing.
Related Issue
Notes for Reviewers