Skip to content

fix: allow running as administrator and patch path/version bugs - #3911

Closed
ahkurdev wants to merge 1 commit into
spicetify:mainfrom
ahkurdev:fix/admin-install-linux-path
Closed

fix: allow running as administrator and patch path/version bugs#3911
ahkurdev wants to merge 1 commit into
spicetify:mainfrom
ahkurdev:fix/admin-install-linux-path

Conversation

@ahkurdev

@ahkurdev ahkurdev commented Aug 28, 2026

Copy link
Copy Markdown

Summary

  • Allow spicetify to run/install under administrator or root without exiting. Previously it hard-failed with os.Exit(1); now it only warns and continues (Spotify normally runs as a normal user). --bypass-admin still silences the warning.
  • Fix Linux Spotify path detection: flatpak/launcher candidate paths containing $HOME were returned as raw literals without env expansion, so detection failed. Now returns the env-resolved path (src/utils/config.go).
  • Guard splitVersion against an empty version string to avoid an index-out-of-range panic (src/preprocess/preprocess.go).
  • Remove an unreachable return err after log.Fatal in Unzip (src/utils/utils.go).

Test plan

  • go build ./... and go vet ./... pass.
  • Built binary and ran it elevated (RunAs administrator): now prints a warning and continues (exit 0) instead of failing.

Co-Authored-By: ahkurdev ah.kurniawan27@gmail.com

Summary by CodeRabbit

  • Bug Fixes
    • Spicetify now continues running from administrator or root shells, with warnings that can be suppressed using the bypass option.
    • Invalid or empty version strings now return a clear error instead of causing a crash.
    • Linux Spotify installation paths now correctly expand environment variables.
    • Archive extraction failures now stop execution immediately with an error message.

- Allow spicetify to run/install under administrator/root without exiting.
  Previously it hard-failed with os.Exit(1); now it only warns and continues,
  since Spotify runs as a normal user. --bypass-admin still silences the warning.
- Fix Linux Spotify path detection: flatpak/launcher candidate paths containing
  '$HOME' were returned as raw literals without env expansion, so detection failed.
  Now returns the env-resolved path (src/utils/config.go).
- Guard splitVersion against empty version string to avoid index-out-of-range panic
  (src/preprocess/preprocess.go).
- Remove unreachable 'return err' after log.Fatal in Unzip (src/utils/utils.go).

Co-Authored-By: ahkurdev <ah.kurniawan27@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6ab12346-d53f-455f-aab1-04c6940c774c

📥 Commits

Reviewing files that changed from the base of the PR and between 1f13f73 and 02c51e9.

📒 Files selected for processing (4)
  • spicetify.go
  • src/preprocess/preprocess.go
  • src/utils/config.go
  • src/utils/utils.go
💤 Files with no reviewable changes (1)
  • src/utils/utils.go

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The changes make elevated execution non-fatal, validate empty version strings, expand fallback Linux installation paths, and terminate on unzip directory-creation failures.

Changes

Runtime behavior updates

Layer / File(s) Summary
Elevated execution handling
spicetify.go
The admin/root check now logs a warning and continues execution. The --bypass-admin flag suppresses the warning.
Version input validation
src/preprocess/preprocess.go
splitVersion returns an "invalid version string" error for empty input.
Linux path resolution
src/utils/config.go
linuxApp returns environment-variable-expanded fallback paths.
Unzip failure handling
src/utils/utils.go
Unzip now calls log.Fatal(err) when directory creation fails.

Estimated code review effort: 3 (Moderate) | ~15–30 minutes

Merge Risk: ⚪ Minimal · up to 02c51

The PR makes localized fixes for administrator execution, Linux path expansion, empty-version handling, and unreachable error handling; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary administrator execution change and the related path and version fixes. It is concise and specific.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rxri

rxri commented Aug 28, 2026

Copy link
Copy Markdown
Member

We don't want users to run spicetify as administrator. It's our choice and it's going to stay this way. Other stuff are not even applicable - when you use AI, at least know what you're changing

@rxri rxri closed this Aug 28, 2026
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