Repository navigation
undo rig's Windows default after a user-mode install as well - #19233
Merged
Merged
Conversation
rig add --user makes the first R it installs the user-mode default: R and Rscript quick links in ~/.local/bin, rig's Current link, and on macOS a login LaunchAgent that sets RSTUDIO_WHICH_R for every GUI application. It also appends to the shell startup files unless ~/.local/bin precedes /usr/local/bin on its PATH. None of that should happen for an R installed from the project R-version warning bar: run rig with ~/.local/bin first on PATH, and remove the default-R files the install created once it exits, restoring launchd's RSTUDIO_WHICH_R. Files that existed before are kept. Also drops a stale duplicate of the #12622 NEWS entry. Addresses #19229
… stays off Opt-in (PW_ALLOW_R_INSTALL=1), as it downloads and installs a build of R into the sandbox home. Creates rig's quick-link directory first: rig 0.11.0 fails outright in a home without one. Addresses #19229
rig 0.11.0 fails outright with "No such file or directory" when ~/.local/bin does not exist yet (r-lib/rig#491), as on a fresh macOS account, so the warning-bar install could not work there. The e2e no longer creates the directory itself. Addresses #19229.
On Windows, rig's first user-mode install writes R.exe, RS.exe and Rscript.exe default shims, sets the current-user R-core default (Current Version and InstallPath on the R and R64 keys, and their WOW6432Node twins), and every install prepends the quick-link directory to the user PATH in the registry. Snapshot those values through PowerShell before rig add runs, and afterwards remove the shims and values rig added, set back the ones it changed, and take only rig's entry out of the PATH. Addresses #19229
PowerShell reads a BOM-less script in the system ANSI code page, so the restore script now carries a UTF-8 byte order mark and the reader's output is marked UTF-8. psQuote doubles the typographic single quotes PowerShell also takes as delimiters, not only the ASCII apostrophe. Also give .rs.rig.userDefaultPaths one branch per platform instead of a shared macOS/Linux body.
RStudio E2E - all platformsAll tests passed!
View / download the full reportView report online -- opens in the browser, no download needed. Available for 14 days. Download playwright-report.zip -- extract and open
All platforms - commit |
…ll-side-effects-windows # Conflicts: # e2e/rstudio/tests/projects/renv_r_version_switch.test.ts # src/cpp/session/modules/SessionRig.R # src/cpp/session/modules/SessionRig.cpp # src/cpp/tests/testthat/test-rig.R
The Windows registry values rig writes are now read and restored through .rs.registryGetValue/SetValue/DeleteValue (SessionRUtil), backed by core::system::RegistryKey, which gains create/getValue/setValue/deleteValue on the wide-character registry API so non-ASCII data round-trips and REG_EXPAND_SZ data is kept as stored. Explorer is told when the user environment changed. tools::pskill(pid, 0) terminates the process on Windows whatever the signal, so the liveness probe is now .rs.isProcessRunning, backed by core::system::isProcessRunning (declared for all platforms, with a Windows implementation via OpenProcess + GetExitCodeProcess). Addresses #19229.
This was referenced Oct 26, 2026
MSVC reads "\x99Brien" as \x99B (C7744, escape sequence out of range).
This was referenced Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #19229. Follows #19230 (now merged), which undoes what rig's first user-mode install does to the user's environment on macOS and Linux and leaves Windows alone.
On Windows
rig add --userdoes the same kind of thing: the first user-mode install writesR.exe,RS.exeandRscript.exedefault shims into%USERPROFILE%\.local\binand sets the current-user R-core default (Current VersionandInstallPathonHKCU\Software\R-core\RandR64, plus theirWOW6432Nodetwins for x86_64 R on arm64), and every install prepends the quick-link directory to the user PATH in the registry. So the rig R becomesRin every new shell and the current user's registry default. RStudio persists its own switch on Windows, so this is about not changing things outside RStudio.This PR extends the same snapshot/restore to Windows:
.rs.registryGetValue/.rs.registrySetValue/.rs.registryDeleteValueinSessionRUtil, backed bycore::system::RegistryKey, which gainscreate,getValue,setValueanddeleteValueon the wide-character registry API (so non-ASCII data round-trips, andREG_EXPAND_SZdata is read as stored rather than expanded). Afterwards, values rig added are removed and values it changed are set back; the user PATH only loses rig's entry (case-insensitive, trimmed, as rig matches it), so anything else that changed the PATH meanwhile survives, and a PATH that did not exist before goes away again rather than being left empty. Explorer is told the user environment changed (WM_SETTINGCHANGE), so shells opened afterwards see the restored PATH. A registry that cannot be read is noted in the job's log and the file cleanup still runs; a restore that fails stays in the snapshot file for the next session to retry, as on the other platforms;Along the way: the liveness probe #19230 uses for another session's snapshot,
tools::pskill(pid, 0), terminates the process on Windows whatever the signal (R'sps_killcallsTerminateProcessfor any signal). It is replaced by.rs.isProcessRunning, backed bycore::system::isProcessRunning, which is now declared for every platform with a Windows implementation (OpenProcess+GetExitCodeProcess, with an inaccessible process counting as running, like EPERM on POSIX).No NEWS entry: the feature is unreleased.
Tests:
test-rig.Rgains cases with an in-memory registry standing in for the routines (shims plus registry default plus PATH entry reverted, pre-existing default restored, PATH-only cases including a differently-cased entry and other concurrent additions, unreadable and unwritable registry) and a probe test.rstudio-tests --scope r --filter 'rig|linter': 355 pass. The core suite gains a WindowsRegistryKeyround-trip test (UTF-8 and%VARS%kept as stored, kinds reported, not-found errors, non-string kinds refused) and anisProcessRunningtest against a live, a terminated and a nonexistent pid; the POSIX suite passes locally (802).The new C++ only compiles on Windows, so CI's Windows build and core tests are the check for it. The flow end to end through
rig add --useris still unverified on Windows: the e2e install test from #19230 skips there, since its checks read rig's files under HOME. Remaining shell call-outs elsewhere are collected in #19285.