Skip to content

fix installer silently keeping a stale codescribe symlink - #35

Merged
gsokoll merged 2 commits into
greenforge-labs:mainfrom
kehindepeters:fix/installer-symlink-replace
Aug 5, 2026
Merged

fix installer silently keeping a stale codescribe symlink#35
gsokoll merged 2 commits into
greenforge-labs:mainfrom
kehindepeters:fix/installer-symlink-replace

Conversation

@kehindepeters

Copy link
Copy Markdown

CreateSymbolicLinkW fails with ERROR_ALREADY_EXISTS when the codescribe link is already present, and the return value was discarded. Re-running the installer therefore left the old symlink untouched while still overwriting config.json, so a config listing new commands could point into an outdated checkout that lacks the corresponding scripts.

  • remove any existing codescribe symlink before recreating it, and refuse to continue if the path exists but is not a symlink
  • check the CreateSymbolicLinkW return value, loading kernel32 with use_last_error so get_last_error works, and declaring restype as BOOLEAN rather than the default int
  • report ERROR_PRIVILEGE_NOT_HELD as the existing 'are you running as administrator?' message, which previously printed success instead
  • create the symlink before backing away config.json, so a failed install leaves the previous one intact

kehinde and others added 2 commits August 4, 2026 12:08
CreateSymbolicLinkW fails with ERROR_ALREADY_EXISTS when the codescribe
link is already present, and the return value was discarded. Re-running
the installer therefore left the old symlink untouched while still
overwriting config.json, so a config listing new commands could point
into an outdated checkout that lacks the corresponding scripts.

- remove any existing codescribe symlink before recreating it, and
  refuse to continue if the path exists but is not a symlink
- check the CreateSymbolicLinkW return value, loading kernel32 with
  use_last_error so get_last_error works, and declaring restype as
  BOOLEAN rather than the default int
- report ERROR_PRIVILEGE_NOT_HELD as the existing 'are you running as
  administrator?' message, which previously printed success instead
- create the symlink before backing away config.json, so a failed
  install leaves the previous one intact

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
exists() and is_symlink() both report False for a junction whose target
is gone, so remove_existing_symlink fell through both branches and
CreateSymbolicLinkW later failed with a bare error code 183. Probe the
path with lstat instead, which sees the reparse point itself, and refuse
with an actionable message for junctions and other non-symlink reparse
points.
@gsokoll
gsokoll merged commit 36446b7 into greenforge-labs:main Aug 5, 2026
2 checks passed
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.

2 participants