Skip to content

Fix panic when global config dir does not exist yet#2497

Merged
fnando merged 3 commits intomainfrom
no-global-dir
Apr 20, 2026
Merged

Fix panic when global config dir does not exist yet#2497
fnando merged 3 commits intomainfrom
no-global-dir

Conversation

@fnando
Copy link
Copy Markdown
Member

@fnando fnando commented Apr 17, 2026

What

Do not crash when global dir cannot be expanded.

Why

Having a local config directory and no global directory was failing, even for commands that are read-only.

Known limitations

N/A

@fnando fnando self-assigned this Apr 17, 2026
Copilot AI review requested due to automatic review settings April 17, 2026 18:22
@fnando fnando added this to DevX Apr 17, 2026
@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Apr 17, 2026
@fnando fnando moved this from Backlog (Not Ready) to Needs Review in DevX Apr 17, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Prevents print_deprecation_warning from panicking when the computed global config directory path doesn’t exist yet (e.g., first-run scenarios), improving CLI robustness for read-only commands that still trigger the local-config deprecation warning.

Changes:

  • Replace fs::canonicalize(...).expect(...) with a non-panicking fallback when canonicalization fails.
  • Add a regression test to ensure print_deprecation_warning doesn’t panic when the global config dir is missing.

Comment thread cmd/soroban-cli/src/config/locator.rs
Comment thread cmd/soroban-cli/src/config/locator.rs Outdated
Comment thread cmd/soroban-cli/src/config/locator.rs
@fnando fnando merged commit b986172 into main Apr 20, 2026
210 checks passed
@fnando fnando deleted the no-global-dir branch April 20, 2026 19:28
@github-project-automation github-project-automation bot moved this from Needs Review to Done in DevX Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants