[Rd] R-2.2.0: malloc probelm in regex code (PR#8287)
gml4410 at ggr.co.uk
Tue Nov 8 15:50:35 CET 2005
Full_Name: Gordon Lack
Submission from: (NULL) (22.214.171.124)
R-2.2.0 fails to build on OSF1 systems.
make: Leaving directory `..../R-2.2.0/src/library/tools/src
Error in list.files(path, pattern, all.files, full.names, recursive) :
invalid 'pattern' regular expression
make: *** [all] Error 1
I've tracked down the problem to change (somewhere) in 2.2.0 vs. 2.1.1 which has
resulted in re_node_set_alloc() (in src/main/regex.c) being called with a size
of 0. Whereas some system (Solaris, Linux, ...) return a valid pointer to a
zero-size allocation, OSF1 returns a NULL pointer on a 0 allocation request
(documented as such, and the Open Group Base Specifications Issue 6 documents
that either may happen). The calling code treats a NULL return as a ESPACE
In R-2.1.1 this code was not asked to allocate 0 sizes, so I suspect that it
shouldn't be happening here either.
A workaround is to add:
if (size==0) size=1; /* OSF1 (at least) returns NULL on 0 alloc */
before the re_malloc (int, size) line in re_node_set_alloc(), which just means
you allocate a small space (which shodul be free()d soon anyway).
The actual regex whcih triggers this during the build is:
More information about the R-devel