Bug 15169 - set_rl_word_breaks() in src/unix/sys-std.c not playing well with others
Summary: set_rl_word_breaks() in src/unix/sys-std.c not playing well with others
Status: NEW
Alias: None
Product: R
Classification: Unclassified
Component: Misc (show other bugs)
Version: R-devel (trunk)
Hardware: All Linux
: P5 normal
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2013-01-13 22:41 UTC by lgautier
Modified: 2013-02-03 16:15 UTC (History)
0 users

See Also:


Attachments
svn diff ran today (1.46 KB, patch)
2013-01-13 22:42 UTC, lgautier
Details | Diff
C code for a shared library that illustrates the problem (1.08 KB, text/x-csrc)
2013-02-03 16:15 UTC, lgautier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description lgautier 2013-01-13 22:41:55 UTC
The function `set_rl_word_breaks` in src/unix/sys-std.c relies on statically allocated strings local to the function, making other C code using the readline library at risk of creating a segfault by trying to free `rl_basic_word_break_characters` or `rl_completer_word_break_characters` when changing them.

The patch attached is against today's R-dev and will likely apply to current R-2.15 branch. With the patch applied, R is building and passing `make check`.
Comment 1 lgautier 2013-01-13 22:42:51 UTC
Created attachment 1404 [details]
svn diff ran today
Comment 2 lgautier 2013-02-03 16:15:11 UTC
Created attachment 1408 [details]
C code for a shared library that illustrates the problem

Should be built with:

R CMD SHLIB R_readline_issue.c

Once built, run the following:

dyn.load("R_readline_issue.so")
break_chars <- "abcdef"
.Call("R_set_completer_delims", break_chars)

Without the patch, segfault. With the patch, all fine.