From ripley at stats.ox.ac.uk  Wed May 23 08:26:30 2007
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 23 May 2007 07:26:30 +0100 (BST)
Subject: [Rd] regexp bug in very recent r-devel
In-Reply-To: <eb555e660705221643w1919e3c6g471bfeab544d194@mail.gmail.com>
References: <eb555e660705221643w1919e3c6g471bfeab544d194@mail.gmail.com>
Message-ID: <Pine.LNX.4.64.0705230718510.3896@auk.stats>

Deepayan,

Thanks.  One bug fix had tickled another here.  grexexpr() is not much 
used in R and when I wrote a regression suite for grep and friends I was 
suprised to find that both grepexpr(perl=TRUE) and grexepr(fixed=TRUE) 
were giving incorrect results in MBCSs (provided multibyte characters were 
actually involved).

Fixed in r41676.

Brian

On Tue, 22 May 2007, Deepayan Sarkar wrote:

> completion is semi-broken in today's r-devel, and the reason seems to
> be some regular expression changes:
>
>> sessionInfo()
> R version 2.6.0 Under development (unstable) (2007-05-22 r41673)
> i686-pc-linux-gnu
>
> locale:
> [...]
>
> attached base packages:
> [1] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods"
> [7] "base"
>> regexpr("o", "foo", fixed = TRUE)
> [1] 2
> attr(,"match.length")
> [1] 1
>> gregexpr("o", "foo", fixed = FALSE)
> [[1]]
> [1] 2 3
> attr(,"match.length")
> [1] 1 1
>
>> gregexpr("o", "foo", fixed = TRUE)
>
> *** caught segfault ***
> address 0xc022fdab, cause 'memory not mapped'
>
> Traceback:
> 1: gregexpr("o", "foo", fixed = TRUE)
>
> Possible actions:
> 1: abort (with core dump, if enabled)
> 2: normal R exit
> 3: exit R without saving workspace
> 4: exit R saving workspace
>
> On a different machine, this freezes R for a long time, consuming CPU
> cycles and a lot of memory, before returning an error:
>
>> gregexpr("o", "foobar", fixed = TRUE)
> Error in gregexpr("o", "foobar", fixed = TRUE) :
>        negative length vectors are not allowed
>> sessionInfo()
> R version 2.6.0 Under development (unstable) (2007-05-22 r41675)
> x86_64-unknown-linux-gnu
>
> -Deepayan
>
> ______________________________________________
> 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] regexp bug in very recent r-devel
Prof Brian Ripley