Skip to content

fix(link): detect broken same-package symlinks and add --overwrite flag#23

Open
jhult wants to merge 1 commit into
neul-labs:mainfrom
jhult:fix/linking
Open

fix(link): detect broken same-package symlinks and add --overwrite flag#23
jhult wants to merge 1 commit into
neul-labs:mainfrom
jhult:fix/linking

Conversation

@jhult
Copy link
Copy Markdown
Contributor

@jhult jhult commented Jun 1, 2026

Two fixes to stout link:

  1. Broken symlinks from prior versions now replaced — When a dangling symlink's target path is under the package's Cellar directory (e.g., 1.15.10 after 1.15.12 is installed), it's correctly recognized as a stale same-package link and replaced. Previously canonicalize() failed on the missing target, causing the code to skip it as "owned by a different package."
  2. --overwrite flag now works — The previously dead --overwrite flag actually removes blocking files/symlinks and creates new ones. The dead --force flag was removed as redundant (to --overwrite).

Two related fixes to stout link:

Detect broken symlinks as stale same-package links: when a dangling symlink's target path resides under the package's Cellar directory (e.g., 1.15.10 after 1.15.12 is installed), recognize it as a stale same-package link and replace it rather than skipping with a warning that it's "owned by a different package." Previously canonicalize() failed on the missing target, so is_same_package resolved to false.

Add --overwrite flag to replace existing files: wire up the previously dead --overwrite flag so that when set, link_package removes and recreates symlinks even when the target is occupied by a symlink from another package, a regular file, or a directory. --force has been removed as it was redundant; its keg-only semantics are not yet applicable to stout.
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