Skip to content

Fix sudo check for non-existent install directories#18

Merged
albertodebortoli merged 1 commit into
mainfrom
fix/sudo-check-nonexistent-install-dir
Jul 26, 2026
Merged

Fix sudo check for non-existent install directories#18
albertodebortoli merged 1 commit into
mainfrom
fix/sudo-check-nonexistent-install-dir

Conversation

@albertodebortoli

@albertodebortoli albertodebortoli commented Jul 26, 2026

Copy link
Copy Markdown
Member

Summary

  • When the install directory doesn't exist yet, [ -w "$INSTALL_DIR" ] always returns false, causing the script to incorrectly require sudo even for user-owned paths like ~/.local/bin
  • Fix walks up the directory tree to find the first existing ancestor and checks writability against that instead
  • This was breaking CI environments where sudo is not available (e.g. GitHub Actions runners)

Test plan

  • Fresh install to ~/.local/bin on a system where the directory doesn't exist yet completes without sudo
  • Install to a system path (e.g. /usr/local/bin) still correctly invokes sudo
  • CI with setup-luca action no longer fails with sudo: command not found

When the install directory doesn't exist yet, walk up to the first
existing ancestor to check writability, rather than checking the
non-existent directory itself (which always returns false and
incorrectly triggers sudo).
@albertodebortoli
albertodebortoli merged commit b9cfd82 into main Jul 26, 2026
2 checks passed
@albertodebortoli
albertodebortoli deleted the fix/sudo-check-nonexistent-install-dir branch July 26, 2026 11:28
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