Skip to content

treat a missing binary dir as having no aliases on macos - #492

Merged
gaborcsardi merged 2 commits into
r-lib:mainfrom
kevinushey:bugfix/missing-binary-dir
Oct 23, 2026
Merged

gaborcsardi merged 2 commits into
r-lib:mainfrom
kevinushey:bugfix/missing-binary-dir

Conversation

@kevinushey

Copy link
Copy Markdown
Contributor

On macOS in user mode, rig list, rig add and anything else that goes through sc_get_list_details() failed with a bare No such file or directory (os error 2) when ~/.local/bin did not exist yet, which is the state of a fresh macOS account that has never installed R with rig. find_aliases() in src/macos.rs called read_dir() on the binary directory unconditionally; the Linux and Windows versions already return an empty list for a missing directory.

This PR splits the directory lookup out of find_aliases() into find_aliases_in(&Path), which returns no aliases when the directory is missing, and adds two unit tests for it (missing directory, and a directory with one alias link plus one plain quick link). NEWS has an entry.

Verified: cargo build, cargo fmt --check, cargo test --bin rig (1117 passed, 11 ignored). With the fixed binary, HOME=$(mktemp -d) RIG_MODE=user rig list prints an empty list and rig add 4.3.999 --user gets as far as the version lookup, where before both failed immediately.

Fixes #491.

@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.50%. Comparing base (d8054fc) to head (efbf55f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #492   +/-   ##
=======================================
  Coverage   65.50%   65.50%           
=======================================
  Files          91       91           
  Lines       47030    47030           
=======================================
  Hits        30809    30809           
  Misses      16221    16221           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gaborcsardi
gaborcsardi merged commit 27a1a28 into r-lib:main Oct 23, 2026
52 of 58 checks passed
@gaborcsardi

Copy link
Copy Markdown
Member

Thank you!

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue and include a link to this pull request.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rig fails with "No such file or directory" in user mode on macOS when ~/.local/bin does not exist

2 participants