Bug 16211 - When calling `R_HOME/bin/Rscript.exe' RScript does not respect escaped quotes in script arguments.
Summary: When calling `R_HOME/bin/Rscript.exe' RScript does not respect escaped quotes...
Status: NEW
Alias: None
Product: R
Classification: Unclassified
Component: Windows GUI / Window specific (show other bugs)
Version: R 3.1.0
Hardware: x86_64/x64/amd64 (64-bit) Windows 64-bit
: P5 normal
Assignee: R-core
Depends on:
Reported: 2015-02-13 16:01 UTC by jameslewisbush
Modified: 2015-02-13 16:01 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description jameslewisbush 2015-02-13 16:01:13 UTC
When calling `R_HOME/bin/Rscript.exe', with commandArgs including escaped quotes, the escaping is not passed correctly to the script.

If you call the i386 or x64 versions explicitly (i.e. `R_HOME/bin/x64/Rscript.exe') then the escaping is correctly passed to the script.

My suspicion is that when you call the `R_HOME/bin/Rscript.exe' version, this executable just defers to the i386 or x64 version, but in doing so somehow messes up the character escaping.

Example 1:
"C:\Program Files\R\R-3.0.3\bin\Rscript.exe" --arch x64 {PATHTOSCRIPT} "a \"quoted\" string"

Example 2:
"C:\Program Files\R\R-3.0.3\bin\x64\Rscript.exe" {PATHTOSCRIPT} "a \"quoted\" string"

If the script just simply writes the command line arguments to a file, we get the following

Example 1: a quoted string
Example 2: a "quoted" string

Snippet of script:
args <- commandArgs(trailingOnly = TRUE)
fileConn<-file(outPath, open="w+a")
writeLines(args, fileConn)