From ripley at stats.ox.ac.uk  Tue Nov  8 17:11:49 2005
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Tue, 8 Nov 2005 16:11:49 +0000 (GMT)
Subject: [Rd] R-2.2.0: malloc probelm in regex code (PR#8287)
In-Reply-To: <20051108145035.8779521ED7@slim.kubism.ku.dk>
References: <20051108145035.8779521ED7@slim.kubism.ku.dk>
Message-ID: <Pine.LNX.4.61.0511081603060.13035@gannet.stats>

Please try R-patched, as this has already been reported for AIX and 
addressed in R-patched and R-devel.

On Tue, 8 Nov 2005 gml4410 at ggr.co.uk wrote:

> Full_Name: Gordon Lack
> Version: 2.2.0
> OS: OSF1/Tur64
> Submission from: (NULL) (193.128.25.20)
>
>
> R-2.2.0 fails to build on OSF1 systems.
>
> .....
> make[4]: 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
> Execution halted
> make[3]: *** [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
> error.
>
> 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:
>
> ^tools($|_)
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] R-2.2.0: malloc probelm in regex code (PR#8287)
Prof Brian Ripley