Skip to content

fix: resolve symlinks when locating script dir - #3

Merged
s-markakis merged 1 commit into
mainfrom
fix/symlink-resolution
Jun 30, 2026
Merged

fix: resolve symlinks when locating script dir#3
s-markakis merged 1 commit into
mainfrom
fix/symlink-resolution

Conversation

@s-markakis

Copy link
Copy Markdown
Owner

Problem

The installer's symlink method (~/.local/bin/cmdr -> repo/cmdr.sh) was broken. SCRIPT_DIR used dirname "${BASH_SOURCE[0]}" without resolving the symlink, so cmdr_functions.sh was looked up in ~/.local/bin instead of the repo:

Error: Functions file '/Users/.../.local/bin/cmdr_functions.sh' not found.

The code comment even claimed it "follows symlinks" but it didn't.

Fix

Walk the symlink chain to resolve the real install directory before computing SCRIPT_DIR.

Test

  • ln -sf repo/cmdr.sh ~/.local/bin/cmdr then cmdr -h now works.
  • Add/list/delete smoke test passes.
  • Direct ./cmdr.sh invocation unaffected.

https://claude.ai/code/session_01By6TY3ZCJmYmCqv1LSwGU3

The symlink install method (~/.local/bin/cmdr -> repo/cmdr.sh) broke
because SCRIPT_DIR used dirname of BASH_SOURCE without resolving the
symlink, so cmdr_functions.sh was looked up in ~/.local/bin instead of
the repo. Walk the symlink chain to find the real install directory.

Claude-Session: https://claude.ai/code/session_01By6TY3ZCJmYmCqv1LSwGU3
@s-markakis
s-markakis merged commit 8a48755 into main Jun 30, 2026
2 checks passed
@s-markakis
s-markakis deleted the fix/symlink-resolution branch June 30, 2026 09:05
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