fix(config): portable perms check with BSD fallback, follow symlinks #6

Merged
w33ble merged 1 commit from fix/bsd-stat-config-perms into main 2026-10-06 10:33:14 -06:00
Collaborator

Summary

  • load_config() perms check now falls back from GNU stat -c '%a' to BSD stat -f '%Lp' so macOS/BSD no longer hard-fail.
  • Both branches use -L to dereference symlinks, so dotfile-managed configs (~/.config/forgejo-cli/config -> ~/dotfiles/...) report the target's mode instead of 777.

Why

  • GNU-only stat -c breaks the CLI on macOS/BSD entirely.
  • Without -L, symlinked configs are falsely rejected as insecure (777 is the link mode, not the file mode).
## Summary - `load_config()` perms check now falls back from GNU `stat -c '%a'` to BSD `stat -f '%Lp'` so macOS/BSD no longer hard-fail. - Both branches use `-L` to dereference symlinks, so dotfile-managed configs (`~/.config/forgejo-cli/config` -> `~/dotfiles/...`) report the target's mode instead of `777`. ## Why - GNU-only `stat -c` breaks the CLI on macOS/BSD entirely. - Without `-L`, symlinked configs are falsely rejected as insecure (`777` is the link mode, not the file mode).
fix(config): portable perms check with BSD fallback, follow symlinks
All checks were successful
shellcheck / shellcheck (pull_request) Successful in 33s
81ae84fe23
w33ble approved these changes 2026-10-06 10:33:10 -06:00
w33ble merged commit 81ae84fe23 into main 2026-10-06 10:33:14 -06:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
w33ble/forgejo-cli!6
No description provided.