Skip to content

fix(post-install): close declarative post-install step gaps - #787

Merged
indaco merged 2 commits into
mainfrom
fix/post-install-steps-symlink-remove
Jul 27, 2026
Merged

fix(post-install): close declarative post-install step gaps#787
indaco merged 2 commits into
mainfrom
fix/post-install-steps-symlink-remove

Conversation

@indaco

@indaco indaco commented Jul 27, 2026

Copy link
Copy Markdown
Owner

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

  • None

Notes for Reviewers

  • None

indaco added 2 commits July 27, 2026 10:08
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
indaco force-pushed the fix/post-install-steps-symlink-remove branch from 639dff9 to c56d249 Compare July 27, 2026 08:08
@indaco
indaco merged commit 9751540 into main Jul 27, 2026
3 checks passed
@indaco
indaco deleted the fix/post-install-steps-symlink-remove branch July 27, 2026 08:08
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)
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