Repository navigation
Skip alias links outside the R root on Windows - #507
Conversation
In user mode, find_aliases() failed the whole command when an R-release.exe/R-oldrel.exe/R-next.exe link pointed at an R outside the current root, which happens after an install into another RIG_R_INSTALL_DIR, or when that variable names the same root with forward slashes. Such a link is now skipped, as on macOS and Linux, and rig system make-links leaves it alone. The version parsing moved into two pure helpers with unit tests. Fixes r-lib#506.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #507 +/- ##
=======================================
Coverage 65.48% 65.48%
=======================================
Files 91 91
Lines 47600 47611 +11
=======================================
+ Hits 31169 31180 +11
Misses 16431 16431 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The six Those jobs pass The same six jobs failed the same way on #490 and #492, both fork PRs, and they pass on If it's useful, the matrix setup step could drop |
This is pretty niche currently, no need for a long NEWS.md entry.
On Windows, an R-release.exe, R-oldrel.exe or R-next.exe link that points outside the R installation directory is skipped. Warn about it, once per link per run, so a missing alias in `rig list` is not a mystery. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks! |
rig's own fix (r-lib/rig#507) converts the slashes itself; the package bundles a rig build that includes it.
|
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. |
Fixes #506.
On Windows in user mode,
find_aliases()failed the whole command when anR-release.exe/R-oldrel.exe/R-next.exelink pointed at an R outside the current root, becausefind_r_version_in_link()bailed when the target did not start withget_r_root()plus a backslash. That took downrig list,rig add's already-installed check, andrig system make-linkswheneverRIG_R_INSTALL_DIR(orr-install-dir) named another root than the one the existing links were made for, and also when it named the same root with forward slashes.find_r_version_in_link()now returnsOption<String>, withNonefor a file that is not a rig link or whose target is not under the root, and both callers skip such a link, as the macOS and Linuxfind_aliases()already do.rig system make-linksleaves the link alone rather than deleting it as unused, since it belongs to another root. The version parsing moved into two pure helpers,user_version_from_link_target()andadmin_version_from_link_target(), with unit tests covering the root-prefix match (including case, forward slashes, a different root, and a root that is a prefix of another directory name) and the admin-modeR-<version>/R-devel/x86_64-on-aarch64 cases.Checked with
cargo fmt --check. The two helpers and their tests are plain string code, so I ran them natively on macOS as a standalonerustc --testbuild (both pass); the Windows build itself, and the tests insidesrc/windows/mod.rs, are left to the Windows CI job, which is why this starts as a draft.