From maechler at stat.math.ethz.ch  Mon Jun 15 14:38:56 2015
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Mon, 15 Jun 2015 14:38:56 +0200
Subject: [Rd] Lack of protection bug in current R release candidate
In-Reply-To: <20150613212404.GA15347@cs.toronto.edu>
References: <20150613212404.GA15347@cs.toronto.edu>
Message-ID: <21886.51040.375672.149849@stat.math.ethz.ch>

>>>>> Radford Neal <radford at cs.toronto.edu>
>>>>>     on Sat, 13 Jun 2015 17:24:04 -0400 writes:

    > The current R release candidate has a lack of protect bug
    > (of very long standing) 

[ but not really reported,  right ? ]

    > with respect to the
    > R_print.na_string and R_print.na_string_noquote fields of
    > the static R_print structure declared in Print.h.  This
    > shows up very occassionally as incorrect output from the
    > following lines in reg-tests-2.R:

    > x <- c("a", NA, "b")
    > factor(x)
    > factor(x, exclude="")

    > The solution (kludgy, but the whole concept is kludgy) is
    > to forward R_print.na_string and R_print.na_string_noquote
    > with the other "roots" in RunGenCollect (after the comment
    > /* forward all roots */).

    >    Radford Neal

"Interesting" ... .. more serioulsy:  Thank you, Radford!

As  this about garbage collection, I found 
I can pretty well reproduce the problem via
something like

   x <- c("a", NA, "b")
  fx <- factor(x, exclude="")
  gctorture2(2, 5)
  r <- replicate(30, capture.output(print(fx)))
  stopifnot(r[,1] == r) 
  # ^^^ fails because of bug

but the R 3.2.1 release candidate probably really cannot be
touched now, with something non-trivial like this.

We'd be *very* happy to get such problems during alpha or beta
testing phase (or even before).

Martin Maechler



[Rd] Lack of protection bug in current R release candidate
Martin Maechler