Skip to content

produce separate UTF-8 rsession binary for ucrt builds - #10524

Merged
kevinushey merged 6 commits into
prairie-trilliumfrom
feature/rsession-windows-utf8-alternate-binary
Feb 8, 2022
Merged

kevinushey merged 6 commits into
prairie-trilliumfrom
feature/rsession-windows-utf8-alternate-binary

Conversation

@kevinushey

Copy link
Copy Markdown
Collaborator

Intent

As discovered in #10507, requesting the use of a UTF-8 code page will cause issues with older versions of R. Unfortunately, because the application code page must be set at build time, the only apparent solution is to build and bundle two separate copies of the rsession.exe executable -- one for older builds of R, and one for newer (UCRT) builds of R.

Approach

Use CMake to produce two separate rsession binaries, one using a "plain" manifest and one using a UTF-8 manifest.

Automated Tests

N/A

QA Notes

To test, when running RStudio on Windows, try running something like:

str(l10n_info())
system(paste("tasklist /FI \"PID eq", Sys.getpid(), "\""))

On older versions of R (< 4.2.0), you should see:

> str(l10n_info())
List of 4
 $ MBCS    : logi FALSE
 $ UTF-8   : logi FALSE
 $ Latin-1 : logi TRUE
 $ codepage: int 1252
> system(paste("tasklist /FI \"PID eq", Sys.getpid(), "\""))

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
rsession.exe                  6008 Console                    2    158,744 K

On newer versions of R (>= 4.2.0), you should see:

> str(l10n_info())
List of 5
 $ MBCS           : logi TRUE
 $ UTF-8          : logi TRUE
 $ Latin-1        : logi FALSE
 $ codepage       : int 65001
 $ system.codepage: int 65001
> system(paste("tasklist /FI \"PID eq", Sys.getpid(), "\""))

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
rsession-utf8.exe            11980 Console                    2    130,096 K

Checklist

  • If this PR adds a new feature, or fixes a bug in a previously released version, it includes an entry in NEWS.md
  • If this PR adds or changes UI, the updated UI meets accessibility standards
  • A reviewer is assigned to this PR (if unsure who to assign, check Area Owners list)
  • This PR passes all local unit tests

@dpprdan

dpprdan commented Feb 8, 2022

Copy link
Copy Markdown

FYI l10n_info() should report a system.codepage starting from R v4.1.0. From its help page in R 4.1.2:

system.codepage integer: the Windows system/ANSI codepage (the codepage Windows is using). Added in R 4.1.0.

@kevinushey
kevinushey force-pushed the feature/rsession-windows-utf8-alternate-binary branch from 4542464 to 02a6e67 Compare February 8, 2022 20:52
@kevinushey
kevinushey changed the base branch from main to prairie-trillium February 8, 2022 20:52
@kevinushey
kevinushey requested a review from gtritchie February 8, 2022 22:22
@kevinushey
kevinushey marked this pull request as ready for review February 8, 2022 22:23

@gtritchie gtritchie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!


#ifdef _WIN32

FilePath resolveSessionPathWin32(const FilePath& defaultPath)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We'll need to port this over to Electron as well (in main). Perhaps open an issue to track doing that?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Will do!

@kevinushey
kevinushey merged commit eef41b7 into prairie-trillium Feb 8, 2022
@kevinushey
kevinushey deleted the feature/rsession-windows-utf8-alternate-binary branch February 8, 2022 23:22
matheustavaresdev added a commit that referenced this pull request Feb 9, 2022
…on-test

* 'main' of github.com:rstudio/rstudio:
  Fix duplicate menu separators (#10533)
  use RSTUDIO_CLI_HYPERLIKNS env var
  Mention issue number in NEWS.
  stamp version into Electron app (macOS)
  fix NEWS
  fix NEWS year
  produce separate UTF-8 rsession binary for ucrt builds (#10524)
  Check if load from base is masked before calling load workspace
  alternate mechanism for R_ResetConsole on Windows (#10510)
  rotate news files (#10528)
  Move old NEWS versions in version/news subdirectory
  Change name back to NEWS.md
  Add RSW section
  Add version numbering to NEWS file to avoid further conflicts/overwrites
  Remove GO NEWS files
  NEWS for Spotted Wakerobin only
  Support ansi hyperlinks (#10416)
  Update to Quarto v0.3.114
@kevinushey kevinushey mentioned this pull request Mar 2, 2022
4 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants