Skip to content

Windows user mode: an alias link outside the current R root makes rig add/list fail #506

Closed

Description

@kevinushey

On Windows in user mode, rig add, rig list, and the other commands that go through sc_get_list_details() stop with

Error: Cannot extract R version from C:\Users\<user>\.local\bin\R-release.exe, invalid R link file?

whenever any R-release.exe/R-oldrel.exe/R-next.exe link in the binary directory points at an R that is not under the current user root. macOS and Linux skip such a link instead. Seen with rig 0.11.0; the code is the same in v0.11.1 and on main.

Reproduce

With a user-mode install and its alias links in %USERPROFILE%\.local\bin (e.g. R-release.exe -> %APPDATA%\rig\data\r\4.5.1\bin\R.exe), point rig at another root:

set RIG_R_INSTALL_DIR=D:\R
rig list --user
rig add 4.3.3 --user

Both fail with the error above. The same happens when RIG_R_INSTALL_DIR names the default root but with forward slashes (C:/Users/<user>/AppData/Roaming/rig/data/r), since the match below is a plain string prefix test, and after switching r-install-dir in the config while the old links remain.

Cause

find_aliases() propagates any error from find_r_version_in_link() with ? (src/windows/mod.rs#L1350). In user mode, find_r_version_in_link() requires the link target to start with get_r_root() plus a backslash, and bails otherwise (src/windows/mod.rs#L1372-L1396). So one alias link into a different root takes down the whole listing, and with it rig add's already-installed check (src/windows/mod.rs#L390) before anything is downloaded. rig system make-links reads the links the same way (src/windows/mod.rs#L1290).

On Linux (src/linux.rs#L1335) and macOS (src/macos.rs#L933), find_aliases() does None => continue when a link's version cannot be worked out, so an alias into another root is simply not reported.

Suggested fix

Have the Windows find_aliases() skip (with a debug!) a link whose target is outside the root instead of failing, matching the other platforms. rig add would then install into the requested root, and rig default/rig system fix-aliases would re-point the links as usual.

Context

This is behind rstudio/rstudio#19468: RStudio runs the bundled rig with RIG_R_INSTALL_DIR set to the destination the user confirmed. rstudio/rstudio#19476 fixes the forward-slash case on RStudio's side, but a destination other than the folder the existing links point into still fails until rig tolerates the link.

Activity

  1. github-actions commented on Nov 22, 2026

    @github-actions

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

  2. locked as resolved and limited conversation to collaborators on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions