Skip to content

Fix: resolve symlinks when computing FLEET_ROOT (closes #3)#4

Merged
oguzhnatly merged 1 commit into
oguzhnatly:mainfrom
wrsfmss:fix/symlink-resolution
Apr 29, 2026
Merged

Fix: resolve symlinks when computing FLEET_ROOT (closes #3)#4
oguzhnatly merged 1 commit into
oguzhnatly:mainfrom
wrsfmss:fix/symlink-resolution

Conversation

@wrsfmss
Copy link
Copy Markdown
Contributor

@wrsfmss wrsfmss commented Apr 27, 2026

Summary

bin/fleet:25 computed FLEET_ROOT from ${BASH_SOURCE[0]} directly. When the script was invoked through the ~/.local/bin/fleet symlink that fleet init creates as documented in _meta.json and the README, dirname/.. resolved to the symlink's parent (~/.local) instead of the install root. Every subsequent source "$FLEET_ROOT/lib/..." then failed with No such file or directory, leaving the CLI unusable from PATH after a vanilla install.

This change wraps ${BASH_SOURCE[0]} in realpath, which is already used at bin/fleet:17 for the same kind of resolution.

-FLEET_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+FLEET_ROOT="$(cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")/.." && pwd)"

Test plan

  • Before patch: git clone … ~/.local/share/fleet && ~/.local/share/fleet/bin/fleet init && fleet --version fails with lib/core/config.sh: No such file or directory
  • After patch: same flow → fleet --version correctly prints fleet v3.0.4, fleet agents runs, all source lines resolve
  • Direct invocation via the absolute path still works (no regression for the no-symlink case)

Fixes #3.

bin/fleet computed FLEET_ROOT from ${BASH_SOURCE[0]} directly. When the
script was invoked through the ~/.local/bin/fleet symlink that
`fleet init` creates, dirname/.. resolved to the symlink's parent
(~/.local) instead of the install root, breaking all subsequent
`source "$FLEET_ROOT/lib/..."` loads.

Wrap ${BASH_SOURCE[0]} in realpath so the symlink is resolved before
parent computation. realpath is already used at bin/fleet:17.

Fixes oguzhnatly#3.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Owner

@oguzhnatly oguzhnatly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked against issue #3. This fixes the exact failure mode with the smallest possible change. Resolving ${BASH_SOURCE[0]} through realpath before computing FLEET_ROOT is the right move here, and realpath is already used elsewhere in this entrypoint, so this does not add a new portability assumption. Approving.

@oguzhnatly oguzhnatly merged commit 4399fc9 into oguzhnatly:main Apr 29, 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.

bin/fleet does not resolve symlinks; CLI broken when invoked via ~/.local/bin/fleet

2 participants