[R] Rgui.exe fix for "console not found" buffer overflow problem
Jesse A. Canchola
jcanch at gmail.com
Sun Oct 29 16:33:30 CET 2006
I'm using R on Windows XP Professional SP2.
I figured out the fix for my buffer overflow problem that did not allow me
to use Rgui.exe for about two weeks. I would keep getting "console not
found" and even when I uninstalled and re-installed got the same problem.
Here's how the problem started. In Rgui.exe, I attempted to get more
visible output in the buffer (I wanted to be able to scroll up the to the
top and see the variable names, etc.), so I put the max of all 9's in the
Rgui.exe
pull-down menus
Edit > Gui Preferences... > buffer bytes 9999999999999
and
> lines 9999999999999999999
not realizing this would effectively break the Rgui.exe and no matter what
you did to clean R out of your machine and re-install it, you would get
the same thing (with both v2.3.1 and v2.4.0). After a couple of weeks of
using Rterm.exe and meeting deadlines, I finally had time to wade through
the vague references online regarding where the problem might be.
Here's the fix.
Basically, you have to find the Rconsole file (no file extension) outside of
the R installation directories. The installation directories will have at
least two copies but those will not be chosen first by the R environment.
What this means is that even if you delete every trace of the
installation, the Rconsole will linger unbenownst to you ready to strike
when you re-install. I found the errant copy in my "My Documents" folder
on my desktop. The way I did it was to copy and paste the following (in its
entirety) in the Rterm.exe window (found at the bottom of ?Rconsole help
file within Rterm.exe):
#### BEGIN R CODE ####
ruser <- Sys.getenv("R_USER")
cat("\n\nLocation for personal configuration files is\n R_USER = ",
ruser, "\n\n", sep="")
## see if there are personal configuration files
sapply(c("Rconsole", "Rdevga"), function(x)
file.exists(file.path(ruser, x)))
## show the configuration files used
showConfig <- function(file)
{
ruser <- Sys.getenv("R_USER")
path <- file.path(ruser, file)
if(!file.exists(path)) path <- file.path(R.home(), "etc", file)
file.show(path, header=path)
}
showConfig("Rconsole")
##### END CODE ####
This will bring up the Rconsole file wherever it exists. Simply open up
the file (if not already open) in the free within-Windows Wordpad.exe
(Start > Run > Open Wordpad.exe) and change the values back to some
smaller number. For me I changed the problematic "bufbytes" and
"buflines" below:
### BEGIN Rconsole Code Portion ###
# memory limits for the console scrolling buffer, in bytes and lines
bufbytes = 9999999999999
buflines = 9999999999999999999
###
to something small like
### BEGIN Rconsole Code Portion ###
# memory limits for the console scrolling buffer, in bytes and lines
bufbytes = 25000
buflines = 50000
###
And voila! my Rgui.exe worked like a charm. It was fun using the
Rterm.exe while it lasted -- forces you to learn code you usually take for
granted in the windows environment. ;O)
Regards,
Jesse A. Canchola
Biostatistician III
Bayer Healthcare, Diagnostics Division
Berkeley, California USA
e-mail: Jesse.Canchola.b at Bayer.Com
More information about the R-help
mailing list