[Rd] Regex Crashing R (perl = TRUE) (PR#7564)

Robert.McGehee at geodecapital.com Robert.McGehee at geodecapital.com
Tue Jan 25 22:03:05 CET 2005


R-developers,
I've encountered another perl library regex bug that causes a
segmentation faults on my Linux/Windows R session. I reduced the script
to the snippet below. (Apologies if this was fixed with bug 7479, but
this bug seems quite different).

string <- paste(rep("=", 10000), collapse = " ")
crash <- function(x) {
    for (i in 1:5) {
        x <- gsub("[^!]=", " == ", x, perl = TRUE)
    }
    x
}
x <- crash(string)
## Segmentation fault (core dumped)

The above should cause a crash immediately, but if you reduce the size
of the string, either you may get a delayed crash, such that R crashes
after you try to access the "string" object again, or you might get the
odd error:
Error in for (i in 1:5) { : bad for loop sequence

If you set perl = FALSE, then the script runs fine (albeit slowly).

As a side note, is there a good way of incorporating an uncompiled perl
script into an R package to be invoked from a system call? Putting it in
the /src directory seems like the obvious place, but I can't convince R
to copy over the script uncompiled upon installation.

Thanks,
Robert

> version
         _
platform i686-pc-linux-gnu
arch     i686
os       linux-gnu
system   i686, linux-gnu
status
major    2
minor    0.1
year     2004
month    11
day      15
language R


Robert McGehee
Geode Capital Management, LLC
53 State Street, 5th Floor | Boston, MA | 02109
Tel: 617/392-8396    Fax:617/476-6389
mailto:robert.mcgehee at geodecapital.com



This e-mail, and any attachments hereto, are intended for us...{{dropped}}



More information about the R-devel mailing list